Command line script for setting up a temporary tmux session for pair programming.
Installation & Usage
pip install tmuxpair
tmuxpair -h for usage details.
Reasonably Secure Pair Programming
A simple yet powerful way for pair programming is to have a partner connect
to a tmux session on your machine. However, this implies that you give them SSH
access, with the obvious security implications: Your partner now
has complete control over your user account. They could use
scp to copy any of
your files, read your email, or pull a prank on you by messing with your
While you should probably only engage in pair programming with people that you
place a certain minimum amount of trust in, it would be nice to eliminate at
least the obvious ways for your partner to do anything behind your back.
tmuxpair achieves this by using key-based authentication together with the
feature of SSH to limit a key to a specific command. This follows the
approach outlined in Tres Trantham’s blog post. Note that we also lock down
scp access and port forwarding (which could allow your partner to access any
firewalled server on your network).
We can go a little further in ensuring only supervised access by strictly
limiting your partner’s connection to the duration of the pair-programming
tmuxpair does this by by wrapping
tmux; when you run e.g.
the public key in the file
partner_key.pub is temporarily appended to your
~/.ssh/authorized_keys file (with the appropriate options), and
attaches to a tmux session “pair”. As soon as the session ends – or you detach
from it! – your partner’s SSH connection is closed and the original
authorized_keys file is restored.
Of course, if your partner were sufficiently determined to break into your
system, they could still manage to do so. Our assumption here is that
supervised access is “reasonably secure” in most environments. If your partner
does not need write access,
tmuxpair provides a view-only mode that should not
leave any security loopholes.
Security could be enhanced further by running the tmux session under a separate
and dedicated account instead of your normal user account. However, the purpose
tmuxpair script is to provide a robust solution that allows you to
quickly share a terminal with a colleague, without any further setup.