Return to Snippet

Revision: 45705
at May 5, 2011 17:29 by pacifists

Initial Code
You want to make use of the ProxyCommand option of ssh. Here is an example that uses one machine to connect to another.

You can add the following to your ~/.ssh/config file.

Host viatunnel
  IdentityFile ~/.ssh/inside_server_rsa
  ProxyCommand ssh -i ~/.ssh/proxy_server_rsa [email protected] "nc inside.mynetwork 22"
  user myself

This will connect first to [email protected] and use that to make a connection to [email protected]

Now typing: ssh viatunnel will connect using this configuration.

The ProxyCommand line basically runs 'nc' on the first hop of your connection and establishes a tunnel to port 22 on the second server. Then the outside ssh uses that to connect.

See ProxyCommand here at the openssh manual

Initial URL

Initial Description

Initial Title
ssh proxy tunnel

Initial Tags

Initial Language