sharing a console
overview
You can use the screen tool to share a console between
two users - this is useful for remote collaborative development, and
doesn't require nearly as much bandwidth as a desktop-sharing protocol
like VNC.
For this document, I'll use the example of user 'Alice' creating a shared console for 'Bob' to join in on.
setting up the system
You'll need a local installation of screen, and make a few
permissions changes to allow multi-user mode. The screen
binary needs to be setuid-root, and the /var/run/screen
directory needs to be at least mode 0755.:
alice $ sudo chmod u+s `which screen` alice $ sudo chmod 755 /var/run/screenNote that creating setuid-root binaries on a machine is usually not a good idea. I'd advise against doing this on a machine that hosts untrusted users.
setting up the hosting session
User alice needs to run screen and turn
'multiuser mode' on, then allow user bob to access it.
alice $ screen
And then the keystrokes (C-a is ctrl + a):
C-a : multiuser on C-a : addacl bob
Now the session is available to Bob to connect - all he needs is the session id. This is shown by
alice $ screen -ls
and will be something like alice/1942.pts-3.localhost.
connecting to the existing session
Once Alice has started screen and given Bob the session-id,
he can connect with screen -x:
bob $ screen -S session-id -x
Then Alice's console will be available to Bob. Both users will see the output on the console, both are able to input characters.
curious postscript
screen oringated at the Univerity of Erlangen, Germany.
Pictures of Erlangen are
over here.