0
sudo mknod /dev/pts/mytty c 0 9 

mknod: /dev/pts/mytty: Operation not permitted

How come I cannot create a character device file in this directory?

4
  • 2
    en.wikipedia.org/wiki/Devpts Commented Dec 6, 2021 at 5:19
  • 2
    The filesystem (devpts) doesn't support creating any files. Even if you're root, you can't do something that's impossible. Theoretically, it would be possible to overlay-mount that directory with another dir from a fs where you can create files, but that will break /dev/ptmx and any programs which create pseudo-ttys (screen, xterm, ssh, etc) Commented Dec 6, 2021 at 6:56
  • 1
    @UncleBilly any chance you could write that as an answer? Commented Dec 6, 2021 at 7:11
  • if programmatically, there's an example in the manual gnu.org/software/libc/manual/html_node/Allocation.html Commented Jan 11, 2024 at 16:30

1 Answer 1

1

You can create a pseudo-terminal programmatically or using (already created) tools. As an example, here you create /tmp/mypty using socat:

socat pty,link=/tmp/mypty,waitslave -

Then you can read from / write to this file.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.