GNU screen has builtin multiuser support that let’s you share a screen session with another user.
First, create a screen session named with an arbitrary name, e.g. ‘shared’, and attach to it:
[user1@pc ~]$ screen -S shared
To allow other users to use the session, you need to enable multiuser support (Ctrl-a :multiuser on) and add the specific user(s) you want to share your session with to the access control list (Ctrl-a :acladd user2).
If you try to attach to this session with a different user now, you might run into the following problem:
[user2@pc ~]$ screen -x user1/shared Must run suid root for multiuser support.
To fix this, set the SUID bit on the screen binary:
[root@pc ~]# chmod u+s $(which screen) [root@pc ~]# chmod 755 /var/run/screen
You also need to change the permissions of the /var/run/screen
directory to 755
, otherwise screen will complain when you create a new session.
You should be able to connect to the shared screen session now:
[user2@pc ~]$ screen -x user1/shared
If you run into chmod /dev/pts/2: Operation not permitted
remember that a user is not able to manipulate the pty he is on when you run su - user
(in contrast to using ssh user2@host
).
Resources:
http://wiki.networksecuritytoolkit.org/nstwiki/index.php/HowTo_Share_A_Terminal_Session_Using_Screen
https://www.gnu.org/software/screen/manual/screen.html
http://aperiodic.net/screen/multiuser
tmux is powerful than screen,anyway
Pingback: HackTheBox / Backdoor | Berkay Guclu
I found that in the version 4.06 there is a bug, please read my post – https://stackoverflow.com/a/72138639/15314754