If you have ever felt the need to do remote pair-programming and didn’t know of any tools around to help you do that, here is a quick tip using Screen.
Screen is a window-manager that makes it possible to share a single session among users logged onto the same machine, allowing them to interact with each other in real time.
This assumes that you:
a) have access to at least one Linux/Unix box with Screen and SSH enabled.
b) are comfortable working with a command line editor (vi, vim, emacs, etc).
For this example we will be using Screen 4, which is probably already bundled with your favorite Linux distro or OS X. If you happen not to have it, apt-get/yum/port/whatever to install it.
In order to have multiusers on one Screen session, some file permissions need to be changed. Screen needs to be able to be run as root and the /var/run/screen folder needs some executing permission.
sudo chmod +s /usr/bin/screen sudo chmod 775 /var/run/screen
Now the first user – let’s call it foo - can log in to the Linux box via SSH and start a Screen session named pairprog.
[foo@linuxbox ~]$ screen -S pairprog
The user foo, now on Screen, needs to turn on multiuser mode and grant access to his friend, the user named bar.
^A :multiuser on ^A :acladd bar
(^A means ‘control + A’, which is the way commands are passed to Screen)
Now it is time for the user bar to log in to the same Linux box and join foo‘s Screen session.
[bar@linuxbox ~]$ screen -x foo/pairprog
Now both users should see each others’ activities.
Fire up your favorite command line editor, start a voice chat (using Skype or something) and you’re good to go in no time!
Update! It is worth mentioning that the user foo actually shared everything. This might cause security implications, since the guest user (bar) will act as the host user. You can give the host user read-only permission by:
^A :aclchg bar -w "#"
Probably the best way to use Screen for session sharing would be to create a new “public” user and use it as the host for the session. Place all the files under this public users’ directories or other public directories.
Thanks for pointing it out, Pigor!