Working remotely is really the only way to do things moving forward. However, it is more difficult to pair program when you are not sitting side by side at the office. There are some nice tools out there that make this remote pair programing easier. But they are GUIs and slow and I want speed! So here is what I have done to pair program effectively.
- vi or terminal based editor
- ssh enabled box
First only pair program with those you trust to be on your machine.
command="tmux attach -t pair -r" public_ssh_key1 command="tmux attach -t pair -r" public_ssh_key2 command="tmux attach -t pair -r" public_ssh_key3
bind-key R switch-client -r
Since we are going to use vanilla ssh to pair program we need to port forward port 22 to the machine you are going to pair on.
In my case I setup a dynamic DNS using duckdns
We need to tell sshd to use ssh keys instead of passwords
Add or update the following in
PasswordAuthentication no ChallengeResponseAuthentication no
Now that things are ready to go we made it so connections can only connect to tmux sessions labeled
This requires that
tmux new -t pair be created before anyone can connect.
So host computer will setup the
tmux new -t pair and the client(s) would then
ssh firstname.lastname@example.org Once a peer has connected they connect in readonly mode. To toggle edit mode just
ctrl+b R. And again to go back to readonly mode.
There are many different ways to set this up and get running but this is the basic idea. I have been pair programming with way for quite some time and it is very fast and low latency.
Exit the session as a client with
ctrl+b d. If the host closes the session all peers will be disconnected.
tmux 3.2 or greater you can setup multipane edits. As an example one can split panes
ctrl+b % and when a peer connects the host can work in the pane on the left and the peer can work in the pane on the right etc.
Simply modify the command in the
~/.ssh/authorized_keys file to look like this.
command="tmux attach -t pair -r -factive-pane" public_ssh_key1 command="tmux attach -t pair -r -factive-pane" public_ssh_key2 command="tmux attach -t pair -r -factive-pane" public_ssh_key3
When using this mode make sure each host and peers are using the same terminal size or the screen might bounce as users interact with it.