ssh trick – ssh to remote host with bastion host
Lot of times, you have to ssh to a server with bastion host. If you dont know what is bastion host then see this:
Now, in such cases, either you add an entry in “~/.ssh/config” to route the ssh through the bastion host or do ssh to bastion host and then ssh from there to the actual host. But wait, there is always a better way:
ssh -t <bastion host> ssh -t <actual host>
You can use the usernames as required for the 2 hosts and then you will have to enter passwords, first for the bastion host and then the actual host.
BTW, you can use tunneling options as well with the above command.
Related Articles:
- 2018/08/20 ssh – host hopping (with Jump host)
- 2015/03/04 ssh authorized keys – limit ssh session to custom command
- 2011/09/07 ss – utility to investigate sockets.
- 2011/08/29 [Solved] ssh works but scp does not
- 2018/02/26 Send history of current host to some other host over ssh
Authored By Amit Agarwal
Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.