Linux – Share screen session with users in the same group (Linux)

gnu-screengroupslinuxpermissions

I can create a detached screen session using the following command:

[user1@host-pc ~]$ screen -d -m -S sname program

…and resume to it using this command:

[user1@host-pc ~]$ screen -r sname

Is there a way to let users that are in the same group as user1 access the session?

Edit: I've read the man page, and I know about the multiuser mode. I'm asking specifically about allowing to share screen sessions by user groups (/etc/group).

i.e. all users in group users are allowed to share session sname. Without manually acladd'ing each user to screen.

Best Answer

Yes, it is possible, but your screen should have suid bit on and this has some security implications. Basically you should do the following in order to be able to share a screen session:

chmod u+s /usr/bin/screen

Then as a user (let's suppose that its username is user1), you should run screen and run the following two commands in it:

<ctrl+a>:multiuser on
<ctrl+a>:acladd user2

Finally, user2 should be able to connect to the session with the following command:

screen -x user1/

You can find more information here.