Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Below is what happens when trying to use gnu screen. Essentially, it all works fine until I su as another user. then I get a Cannot open your terminal '/dev/pts/7' - please check. error

l413:~$ ssh sbird@example.com
sbird@example.com password: 
sbird@example:~$ screen
[screen is terminating]
sbird@example:~$ su - gradplan
Password: 
gradplan@example:~$ screen 
Cannot open your terminal '/dev/pts/7' - please check.
gradplan@example:~$ 

How can I login as sbird, su to gradplan, and still use screen?

share|improve this question

migrated from stackoverflow.com Oct 3 '11 at 11:51

This question came from our site for professional and enthusiast programmers.

3 Answers 3

up vote 3 down vote accepted

To directly answer your question:

ssh sbird@example.com su grandplan -c “script /dev/null -qc \"screen\""

Don't change the permissions on your /dev/pts/X - it just introduces an unnecessary security hole.

share|improve this answer

Type script /dev/null before starting screen.

$ su - gradplan
$ screen
Cannot open your terminal '/dev/pts/15' - please check.
$ script /dev/null
Script started, file is /dev/null
$ screen
# do whatever inside the screen
[detached]
$

ref: ServerFault: Why does redirecting 'script' to /dev/null/ allow 'screen' to work while su'ed as another user?

share|improve this answer
    
For future readers, I have found su'ing inside screen to actually be better practice, but since this answers what I actually asked better, I accepted this as the right answer. –  Alexander Bird Jul 6 '11 at 10:50

If you:

ls -l /dev/pts/7

You will see it is owned by sbird, when you switch to gradplan, he doesn't have perms to touch that device.

You can try doing

chmod a+rw /dev/pts/X

(X being which pts # you are currently connected to, because it will change) before you screen.

Or you can screen as sbird, then in each screen window su there.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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