SSH through SOCKS5 proxy

I learned a neat trick to connect to ssh to a box over a SOCKS 5 proxy (ssh -D argument) thanks to this post.

ssh -o "ProxyCommand nc -X 5 -x localhost:9999 %h %p" <host>

where <host> is the desired host and localhost:9999 is the address and port of your socks proxy.

It uses netcat (nc) to tunnel the connection through your socks proxy. Neat.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.