Skip to content

Instantly share code, notes, and snippets.

@Jaym3s
Forked from wm/pair.md
Last active December 18, 2015 01:48
Show Gist options
  • Save Jaym3s/5705989 to your computer and use it in GitHub Desktop.
Save Jaym3s/5705989 to your computer and use it in GitHub Desktop.

SSH setup for remote pairing

If Animal and Fozzie wanted to pair on Animals machine and they both have access to shared.muppets.com then they could use the following setup

  • Animal will have the following in ~/.ssh/config
Host tunnel_from_muppets
  Hostname space.muppets.com
  RemoteForward 1235 localhost:22
  User animal
  • Fozzie will have the following in ~/.ssh/config
Host tunnel_to_animals_via_muppets
  Hostname space.muppets.com
  LocalForward 9999 localhost:1235
  User fozzie
   
Host animals_via_muppets
  Hostname localhost
  User fozzie
  Port 9999
  • Animal creates an ssh tunnel to his machine via shared.muppets.com
ssh tunnel_from_muppets
  • Fozzie creates a tunnel to Animals tunnel on shared.muppets.com
ssh tunnel_to_animals_via_muppets
  • Fozzie in another shell can then ssh to Animal's machin as follows
ssh animals_via_muppets
  • Forward the rails server to port 3100 on the client's machine:
Host animals_via_muppets
  Hostname localhost
  User fozzie
  Port 9999
  LocalForward 3100 localhost:3000

This may require you to edit /etc/sshd_config and set PermitTunnel yes (at least on OSX)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment