screen Cannot open your terminal '/dev/pts/0' - please check
To solve the problem try running script /dev/null
as the user you su
to before launching screen
.
script -q -c "su $USER -l -c \"screen -m -d -S $NAME $DAEMON start\"" /dev/null
More on it:
- https://serverfault.com/questions/116775/sudo-as-different-user-and-running-screen/116830
This happens because you may have done a sudo su user_name
and then fired the screen command.
There are 2 ways to fix this.
- Login directly to "user_name" via ssh.
- Take ownership of the shell
by typing
script /dev/null
as the useruser_name
and then typescreen
Run this command to own the shell
#script /dev/null
and try Screen
#screen -r < name of the screen >
Inspired by both endorsed answers here I added the following function to my .bashrc
:
sscreen(){
script -q -c "screen $*" /dev/null;
}
Now I just use sscreen
instead of screen
and never have to think about the issue again.