my musings 

Facebook Twitter LinkedIn YouTube E-mail RSS
formats

SSH Proxy

I recently found a really neat configuration option for ssh if you need to ssh into a box say behind a NAT box. What this does is lets you ssh into an intermediate box and then ssh through that onto another. Place the following in your ~/.ssh/config:

Host fakednsname
  User targetusername
  HostName 192.168.0.2
  ProxyCommand ssh proxyusername@proxyurl nc %h %p 2> /dev/null
You then type “ssh fakednsname” and you ssh through the proxy. This would be like if you did a “ssh proxyusername@proxyurl” followed by a “ssh targetusername@192.168.0.2” on the proxy. Of course 192.168.0.2 and proxyurl can be any ip address or url. This can also be used with scp or rsync.
Hope that helps!

Leave a Reply

Your email address will not be published. Required fields are marked *