I wanted to pair with a friend of mine, exploring Magit mode in Emacs. There are a couple of projects to make it easy to use tmux(-like) to simplify this.

I worked around this, using an ssh reverse tunnels. Here are the steps, for anyone who’d like to reproduce.

  1. Add your partner(-in-crime)’s ssh key to authorized keys on a server that has a public IP (example.com, let’s say).

  2. Add your server’s key to authorized keys on your local machine.

  3. Create a reverse tunnel from your machine to the server.

    ssh -fNR 19999:localhost:22 server_user@example.com
    

    -R 19999 essentially forwards port 19999 on example.com to localhost’s 22. -fN is to say no terminal, send connection to background.

  4. Your partner first ssh’s to example.com and then ssh’s to your laptop.

    On your partner’s machine

    ssh server_user@example.com
    

    On the server, your partner does

    ssh your_username@localhost -p 19999
    

    Your partner is on your machine, and can run rm -rf! But, hopefully they’ll only run tmux attach. Obviously, do this only with people you trust!

  5. Start a tmux session locally.

  6. Profit!