Simplify Multi-Hop SSH Connections and Transparently Proxy SSH Connections

Simplify Multi-Hop SSH Connections and Transparently Proxy SSH Connections

Content #

Put the following in the ~/.ssh/config file.

Host jumphost.example.com
  ProxyCommand none
Host *.example.com
  ProxyCommand ssh -W %h:%p jumphost.example.com

If you need to access a host that sits behind an SSH gateway server or jump server, you can make your life easier by telling SSH to automatically use the SSH gateway when you connect to the final remote host.

Instead of first connecting to the gateway and then entering another ssh command to connect to the destination host, you simply type “ssh destination-host” from your local machine. Using the above configuration, this command will proxy your ssh connection to server1 through jumphost.

$ ssh server1.example.com
$ uname -n
server1
$

From #