https://www.nadeau.tv/ssh-with-a-bastion-host/
ssh -o ProxyCommand='ssh -W %h:%p user@bastion' user@target
To let scp/rsync/debuuger connect, edit your ~/.ssh/config file to define the proxy command and other params. For example:
Host bastion # if bastion is not in your /etc/hosts
Hostname my-bastion-host.example.com
Host my_server
Hostname 10.0.1.18 # Not really needed
ProxyCommand ssh bastion -W %h:%p
then you can use:
$ ssh my_server
Two things:
- Make sure your keys are available in the authorized keys of the target.
- On the bastion, set option
PermitTunnel yesin the /etc/ssh/sshd_config. Restart ssh