Pages

Tuesday, April 21, 2009

Start screen after sudo su to another user


Sudo'ing to a user then running screen doesn't work out of the box.  Typically you get the following error:

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



From the blog, here's the procedure
sudo su - someuser
script /dev/null
screen


Should work now.  

6 comments:

Unknown said...

Hi.

As your post helped me when I got this error, I'll give you another solution, I think it is the one that is expected to be the right one for screen :

in your screen windows :

(enter screen command mode) CTRL-a :
(allow multiuser) multiuser on

(enter screen command mode) CTRL-a :
(grant access to users) addacl root

The user to grant here is root if you use sudo, but you can give any unprivileged user provided you add screen setuid.

Then as your user attach the screen running by the other user :
sudo screen -x other_user/

Georgi Georgiev said...

There is actually a better option with screen -d -m parameters. Also it is possible to do it with a little hack with chmod + tty command.

I've recently written a short article as I have experienced the same issue as you.
If you want you can take a look at it -
http://www.pc-freak.net/blog/how-to-work-around-screen-cannot-open-your-terminal-devpts1-please-check/

Best,
Georgi

Nick Craig-Wood said...

Best tip ever - thanks!

Unknown said...

You saved my day!

Thumbs up man

Unknown said...

Thanks for your help on this easy fix for sudo accounts!

Fluffy Saw said...

nice workarround, thanks for sharing