Saturday, September 12, 2009

Share terminal session to remote user using screen

Taken from the following article.

http://ubuntuforums.org/showthread.php?t=299286

Case Scenario:

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.

Requirements:
- GNU Screen
- Local account on host computer for remote user (i.e. bjones requires local account)

1. Install screen
Code:
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.
Code:
sudo chmod +s /usr/bin/screen
Code:
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.
Code:
screen -S screen-test
4. The remote user (bjones) uses SSH to connect to the host computer (jsmith).
Code:
ssh bjones@jsmith.computer.ip.address
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).
Code:
CTRL-A
:multiuser on
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.
Code:
CTRL-A
:acladd bjones
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.
Code:
screen -x jsmith/screen-test

No comments:

Blog Archive