Last active
June 22, 2018 20:14
-
-
Save lorenzosaino/d046d2733f27a2f9f303 to your computer and use it in GitHub Desktop.
SSH config to connect to an SSH server through an SSH proxy without netcat
This file contains 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
# These are SSH configuration examples to connect to an SSH server via | |
# an SSH proxy. These solutions, differently from other solutions found | |
# on the Web, do not require netcat. | |
# | |
# CLIENT -------- PROXY_HOST ------- TARGET_HOST | |
# | |
# This config entry allows you to connect to a specific machine behind an | |
# SSH proxy | |
Host <TARGET_HOST> | |
HostName <TARGET_IP_ADDRESS_OR_HOSTNAME> | |
User <USERNAME_ON_TARGET> | |
ProxyCommand ssh -q -A -x <PROXY_HOST> -W %h:22 | |
# This config entry allows you to connect to any machine behind an SSH | |
# proxy just specifying a suffix that indicates to SSH to connect through | |
# the proxy | |
Host *.<SUFFIX> | |
User <USERNAME_ON_TARGET> | |
ProxyCommand ssh -q -A -x <PROXY_HOST> -W `basename %h .<SUFFIX>`:22 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I tried several different
~/.ssh/config
file strategies that didn't work because I don't have access to netcat on the proxy host. This finally did the trick, thanks for sharing!