Ben Woodall

Last of the freelance hackers - Greatest sword fighter in the world

Setup for Remote Pairing

linux, pairing

I’ve been trying to get into the swing of things with pair programming lately. #pairwithme has been blowing up on Twitter, so buddying up with a fellow dev to learn(or teach) a thing or two is pretty easy.

I’ve seen a lot of different posts on how to get going with pair programming. Many of them suggest having another person ssh in to your computer and have at it. I like to keep remote work separate though AND I just happen to have a VPS for just such a thing. So let’s set up remote pair programming!

On your remote machine, create a new passwordless user:

 $ sudo adduser --disabled-password pair

This will create a new user with no password on your machine. We’re not going to be needing a password because users will be logging in with their ssh keys.

When I first set this up, I was keeping track of my friends keys and adding them to the pair users .ssh, but that got really old, really quick. Luckily, there’s an app for that! Or a gem really…

Hopefully you have ruby installed on your remote machine. Now, depending on how you have your environment setup and where you have your ruby gems installed, you’ll need to make sure the pair user has permissions to install gems and use them locally. It does? Awesome, let’s keep going.

Install Chris Hunts awesome github-auth gem. This will let us grab a users SSH keys from Github and add them to your authorized_keys.

 $ gem install github-auth

To add or remote a user to pair with:

 $ gh-auth add benwoody
Adding 2 key(s) to '/home/pair/.ssh/authorized_keys'

 $ gh-auth remove benwoody
Removing 1 key(s) to '/home/pair/.ssh/authorized_keys'

To get this going, add yourself to the authorized_keys and then add your friend.

Then, both of you can simply

 $ ssh

and BAM you got some pairin’ goin’ on!*

When you’re done, just remove their access!**

* I’ll probably write up a nice post on how I have my pair environment set up at a later date.

** Note that this setup means you have some sort of trust with the person you are pairing with. This probably isn’t the BEST security practice. Optionally, you could add the pair user to a group with limited access.