Wednesday, July 25, 2018

ssh: ssh a remote host via a bastion

Source: SSH ProxyCommand example: Going through one host to reach another server

In order to reach remote1 through a bastion host, add the following lines in your .ssh/config:
Host bastion
HostName bastion-01.golgoth.com
User jgallinari

Host remote1
HostName remote1.toto.swir
User jgallinari
ProxyCommand ssh jgallinari@bastion -W %h:%p
Then ssh remote1 should do it.