Skip to content

Instantly share code, notes, and snippets.

@bidulock
Last active August 29, 2015 14:25
Show Gist options
  • Save bidulock/1dab73e983efd471f283 to your computer and use it in GitHub Desktop.
Save bidulock/1dab73e983efd471f283 to your computer and use it in GitHub Desktop.
ssh through another host
# Taken from this blog post
# http://chrigl.de/blogentries/ssh-jump-host-without-nc-netcat
# Add the following to ~/.ssh/config, and adapt for your usage
#
# ProxyCommand ssh -A proxy_through_host -W %h:22
# -A -- ssh-agent forwarding [optional]
# (can be added to proxy host definition)
# proxy_through_host -- hostname of server to proxy through [required]
# -W %h:22 -- forward standard io to %h:22 (port 22) [required]
# %h is replaced with the host you're actually
# connecting to. This should be the internal ip
Host proxy_through_host
HostName proxy.through.host.com
Host foo
HostName 192.168.1.99
ProxyCommand ssh -A proxy_through_host -W %h:22
Host bar
HostName 192.168.1.11
ProxyCommand ssh -A proxy_through_host -W %h:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment