Last Updated: December 26, 2018
· fsproru

Pair program anywhere with tmux over SSH tunnel

I pair program a lot these days. There is a handful of tools for pair programming. I like to use a shared tmux session over ssh because of the low latency.

Sometimes either me or my pair works from home. For a long time I was messing with my router to enable a port forwarding to my laptop. It turns out there is an easier way to pair program from almost any location.


  1. Given there is a remote machine at
  2. You and your pair can ssh into


1) Create a user named pair on your local machine

2) Create a tmux session

$ tmux -S /tmp/pair
$ chmod 777 /tmp/pair

3) Create a ssh tunnel between your local machine and

$ ssh -R 2222:localhost:22

4) Tell you pair to ssh into

$ ssh

5) Now your pair needs to jump through the tunnel

$ ssh -p 2222 -l pair localhost

6) And attach to your tmux session

$ tmux attach -S /tmp/pair

7) You're both in. Hack Hack Hack ;)

Happy pairing