/

SSH via a bastion server

OpenSSH

You have a server behind a VPC, and has firewall rules that forbid the server from being accessed directly. Fortunately, you have a bastion server that is allowed to connect to the server behind the VPC, and will allow you to SSH to it.

You can use the bastion server proxy your way into the server behind the VPC.

Here's how:

ssh -tt $USERNAME_HOST_BASTION "ssh $USERNAME_HOST_OTHER_SERVER"

Without the -tt flag, we won't be able to interact with the shell session initiated on the other remote server.

The $USERNAME_HOST_BASTION is the login credentials to the bastion server.

The $USERNAME_HOST_OTHER_SERVER is the login credentials to the other server.

Edit this page
Want to make your own site like this? Try gatsby-theme-code-notes by Zander Martineau.
Notes on code. My second brain, by Sal Rahman.