Every time I log into a VM with root, su into a user account, and try to use screen it throws an error:

Cannot open your terminal '/dev/pts/0' - please check.

A Stack Overflow post said I needed to use script /dev/null to fix it, and it works, but it still doesn't explain why I need to type script /dev/null. I would like to understand what it does and why I need to type it.


1 Answer 1


You cannot open /dev/pts/0 because it's owned by root, and after you su-ed into another user you're no longer able to open it via its path, but you're still able to use it via the opened handle to it, which was inherited from the parent process.

script /dev/null will create another pty, owned by the current user.

Anyways, that bug/limitation seems to have been fixed in recent versions of screen (eg. 4.99.0), which will correctly send the handle to the current terminal via the SCM_RIGHTS ancillary message on a unix domain socket, instead of sending just the name of the terminal and have the screen server try to open it (and fail). Same thing with tmux.

  • The handle was not inherited from the parent process. When you connect to the tmux or screen server from some random terminal, the server cannot "inherit" the terminal you're connecting from.
    – mosvy
    Mar 26, 2020 at 15:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.