Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@rondale-sc
Forked from rwjblue/steps.md
Created April 17, 2013 01:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rondale-sc/5401113 to your computer and use it in GitHub Desktop.
Save rondale-sc/5401113 to your computer and use it in GitHub Desktop.

Start with a machine that is directly accessible to both parties via SSH (linode, EC2, prgmr.com, etc), and that you can add users to. DO NOT USE root!!!!

Usage

##From the hosts local machine:

ssh -R1337:localhost:22 host@<shared server's ip address/hostname>

In another terminal window (or tab):

tmux -S /tmp/pair

Then from inside your new tmux session execute:

chmod 777 /tmp/pair

From the pairs local machine:

ssh pair@<shared server's ip address/hostname>

Setup

##Shared Host Setup - Once

Setup a user for the host of the pair session:

sudo adduser host

sudo su - host
mkdir ~/.ssh
chmod 700 ~/.ssh

Setup a user for your pair to connect as:

sudo adduser pair

sudo su - pair
mkdir ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t rsa -C "pair@ircely" 

Shared Host Setup - Each Pair

Add the following to the users authorized_keys file:

command="ssh pair@localhost -p 1337",no-port-forwarding,no-X11-forwarding,no-agent-forwarding <pair users public key (can use github API like: https://api.github.com/users/rjackson/keys)> 

Shared Host Setup - Each Host

Add the host users public key to the /home/host/.ssh/authorized_keys file

Local Setup - Each Host

Add a user for the pair to your local system:

On ubuntu/debian:

sudo adduser pair

(Use system preferences for Mac OSX)

# execute the following once the user is created
sudo su - pair
mkdir ~/.ssh
chmod 700 ~/.ssh

Add the following line to the pair users ~/.ssh/authorized_keys (note that the /usr/local/bin/tmux bit will be different based on the location of tmux executable):

command="/usr/local/bin/tmux -S /tmp/pair attach",no-port-forwarding,no-X11-forwarding,no-agent-forwarding <pair-users-ssh-public-key (from shared internet host /home/pair/.ssh/id_rsa.pub)> 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment