Saturday, August 12, 2017

Sharing a Terminal Or SSH session using screen

Objective : I want to access a ssh session of  user1 on server 192.168.1.1  and see what all command he types in there using the same user  user1 on server 192.168.1.1
Solution : We can  do this using the multiuser function of screen.Assuming you use the same user name to ssh in and connect as the other user is using.
Step 1 :  One person needs to  create the screen by selecting a name for the session and then typing
# screen -L -S <SESSIONNAME>
Then other user  can ssh into the machine, and join this screen
sudo screen -x <SESSIONNAME>
And even after the session ends  you can view all the commands that were typed by the user1 looking at the

.screenlog