Remote Pair Programming with Screen 5

Posted by caike on May 15, 2009

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!

Trackbacks

Use this link to trackback from your own site.

Comments

Leave a response

  1. Paulo Igor Sun, 17 May 2009 11:59:20 PDT

    Spartan solution very interesting…the other user shared server’s terminal, only terminal and a specific directory (the project directory, for example)…is it?

  2. PotHix Sun, 17 May 2009 22:47:29 PDT

    Æ!!

    Really interesting! Tks for your post!
    I’ll test this technique ASAP! =D

  3. caike Tue, 19 May 2009 10:14:13 PDT

    The other 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 "#"

    I think 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 out and I will update the post with this info!

  4. Marcelo andrade Wed, 22 Jul 2009 13:19:33 PDT

    I’ve checked this in your twitter. It seems so simple and interesting. In fact, the Unix command line tools can be turned into an excelent IDE for programming.

    I’d like to try it remotelly with someone in a project. Any chances? :-P

  5. caike Thu, 23 Jul 2009 11:25:15 PDT

    Sure! I’ve done it a few times with a friend of mine and it worked out perfectly.
    Let me know if you have any problems. I’ll try to help you as much as I can.

Comments

Anti-Spam Protection by WP-SpamFree