Skip to content

Instantly share code, notes, and snippets.

@thefonso
Last active October 14, 2015 01:28
Show Gist options
  • Select an option

  • Save thefonso/4286864 to your computer and use it in GitHub Desktop.

Select an option

Save thefonso/4286864 to your computer and use it in GitHub Desktop.
tmux pairing via ssh tunnel
both thefonso and kosh can log into name_of_some-machine.com
Note: if you don't have a github account take a look at this to generate your keys...
https://help.github.com/articles/generating-ssh-keys
tmux pairing via ssh tunnel
Step 0: both users edit ~/.ssh/config
thefonso:
Host tunnel_from_fonso
Hostname name_of_your_machine.com
RemoteForward 1235 localhost:22
User thefonso
# ssh -R 1235:localhost:22 thefonso@name_of_some_machine.com
kosh:
Host tunnel_to_fonso
Hostname name_of_some_machine.com
LocalForward 9999 localhost:1235
User kosh
# ssh -L 9999:localhost:1235 kosh@name_of_some_machine.com
Host fonso_via_ec2
Hostname localhost
User kosh
Port 9999
# ssh localhost -p 9999
Step 1:
kosh: gets public ssh key
cat ~/.ssh/id_rsa.pub
kosh: copy paste cat results to thefonso via chat (or whatever)
thefonso: edits keys file on ec2.com
vim ~/.ssh/authorized_keys
paste the public key in authorized_keys
Step 2:
thefonso creates an ssh tunnel to his machine via ec2.com
thefonso:
ssh tunnel_from_fonso
Kosh creates a tunnel to thefonso's tunnel on ec2.com
kosh:
ssh tunnel_to_fonso
Kosh in another shell can then ssh to thefonso's machine as follows
kosh:
ssh fonso_via_ec2
note: this may be usefull...http://paulstamatiou.com/how-to-surf-securely-with-ssh-tunnel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment