3

I am trying to use screen with another user than I logged in. The command is started with:

sudo -u user /usr/bin/screen -A -m -d -S screen ./nice_command

For reattaching I am using screen -x screen, but it always says:

There is no screen to be attached matching screen

What is my mistake?

EDIT:

screen -x user/22969.screen
There is a screen on:
        22969.screen       (12/13/2011 11:37:43 PM)        (Private)
2
  • Do a screen -ls to see which screen sockets you have and what their names are.
    – micke
    Dec 13, 2011 at 22:18
  • I got following output No Sockets found in /var/run/screen/S-root. .
    – CSchulz
    Dec 13, 2011 at 22:21

1 Answer 1

6

Since you did su -u user to get a screen session it now belongs to user.
You need to do sudo -u user screen -x screen to attach to it.

Or specify the path to it ( screen -x user/[pid].screen ) if the screen is in multiuser mode and you have access to it. screen -ls user/ will give you info on sessions for user.

For multiuser screen to work you need to have it enabled ctrl+a:multiuser on and add users ctrl+a:acladd root (or other user). This is done from within screen.
Screen also needs to be setuid chmod u+s $(which screen) and screen sockets dir must be readable. (This is almost always the case already).

(good guide here: http://aperiodic.net/screen/multiuser )

4
  • It seems that the screen is private and that is the reason why I can't reattach it (see above).
    – CSchulz
    Dec 13, 2011 at 22:55
  • 1
    I edited my post to include info about multiuser screen sessions.
    – micke
    Dec 13, 2011 at 23:19
  • Thanks, there is a missing spell in multiuser. Is there any possibility to do that over a shell script or anything like that?
    – CSchulz
    Dec 14, 2011 at 7:35
  • Put multiuser and acladd lines in the config file .screenrc. I found a good guide here: aperiodic.net/screen/multiuser
    – micke
    Dec 14, 2011 at 8:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .