This is too good to risk losing so I’m reproducing the recipe here.
For my needs, I was able to skip a few steps by using root and by using screen session ids.
Here is the original article (with a couple of minor changes):
Assume user jsmith wants to share his terminal session with remote user bjones for training or troubleshooting purposes, but does not want to use VNC or other full-blown GUI remote control access.
– GNU Screen
– Local account on host computer for remote user (i.e. bjones requires local account)
1. Install screen
sudo apt-get install screen
2. Set the screen binary (/usr/bin/screen) setuid root. By default, screen is installed with the setuid bit turned off, as this is a potential security hole.
sudo chmod +s /usr/bin/screen
sudo chmod 755 /var/run/screen
3. The host starts screen in a local xterm, using the command screen -S SessionName. The -S switch gives the session a name, which makes multiple screen sessions easier to manage.
screen -S screen-test
4. The remote user (bjones) uses SSH to connect to the host computer (jsmith).
ssh [email protected]
5. The host (jsmith) then has to allow multiuser access in the screen session via the command CTRL-A :multiuser on (all ‘screen’ commands start with the screen escape sequence, CTRL-A).
6. Next, the host (jsmith) must grant permission to the remote user (bjones) to access the screen session using the commadn CTRL-A :acladd user_name where user_name is the remote user’s login ID.
7. The remote user can now connect to the hosts ‘screen’ session. The syntax to connect to another user’s screen session is screen -x host_username/sessionname.
screen -x jsmith/screen-test