Recently, I was helping another forum member setup and troubleshoot an SSH server and we were looking for an easy way to "share the terminal", so that he could see what I was typing & vice-versa. The problem was that he was on dial-up and using VNC was not a very feasible option.
In the end, I just created a local account on my computer so that he could SSH into my computer and we used the 'write' command to pass messages back and forth between us. After we resolved the problem, I was still interested in finding out if there was an application that allowed users to "share" a terminal session (i.e. they could both interact with the same terminal session and see what the other was typing).
After doing some searching, I found 'screen', which is labeled as a "Remote terminal viewer". Most of these steps are pulled verbatim from this article, however, I made some minor modifications for clarity and added a few steps for the new user.
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
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 apt-get install screen
sudo chmod +s /usr/bin/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.
sudo chmod 755 /var/run/screen
4. The remote user (bjones) uses SSH to connect to the host computer (jsmith).
screen -S screen-test
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.
Attached is a screenshot of 2 computers "sharing" the same terminal session.
screen -x jsmith/screen-test