Last active
April 27, 2020 14:12
-
-
Save Rillke/e2ceb88529aef1ae03f7f1c06c8376a2 to your computer and use it in GitHub Desktop.
SSH through bastion host: SSH and PuTTY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Linux: ~/.ssh/config: | |
<code> | |
Host SHORTCUT | |
Hostname FULLURL_OR_IP_TARGET_HOST | |
User USERNAME | |
Host FULLURL_OR_IP_TARGET_HOST | |
ProxyCommand ssh -a -W %h:%p BASTION_HOST | |
Port NUMBER | |
Host *.BASTION_HOST | |
User BASTION_USERNAME | |
</code> | |
<code>ssh SHORTCUT</code> | |
* Windows (PuTTY): | |
* Convert an openSSH key to a PuTTY compatible ppk key, e.g. using PuTTYgen or create a new key pair (but we need it in openSSH format on the server for the authorized_keys) | |
* Add the key to pageant so it can be automatically retrieved by PuTTY when required. If you forget doing so, PuTTY gets stuck with an empty terminal window shown and plink.exe running in background. | |
* Host Name: FULLURL_OR_IP_TARGET_HOST | Port: NUMBER | Connection type: SSH | |
* Connection -> Data: Auto-login username: USERNAME | |
* Connection -> Proxy: Proxy type: Local | Proxy hostname: BASTION_HOST | Port: BASTION_PORT | Username: BASTION_USERNAME | Telnet command, or local proxy command: plink.exe -P 22 -i "C:\path\to\key\id_rsa.ppk" %user@%proxyhost setup_terminal_proxy %host %port | |
* Connection -> SSH -> Auth: Private key file for authentication: C:\path\to\key\id_rsa.ppk | |
* Save profile | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment