How do I connect to a server behind an socks5 proxy through SSH on mac/linux?
ssh -o ProxyCommand='nc -x 127.0.0.1:30000 %h %p' [email protected]
where 127.0.0.1:30000
is the socks5 proxy. Credit: Jethro Carr
you'll need a connect module for ssh which is able to connect through SOCKS.
We use it in our Lab all the time, here's our documentation on how to get it: https://wiki.enterpriselab.ch/el/public:tools:ssh#using_socks_proxy
In Ubuntu (and I believe so in Debian too) it's available as package, just install with
apt-get install connect-proxy
it will get installed as /usr/bin/connect-proxy
-D
creates a SOCKS proxy. If you want to connect via a SOCKS proxy instead then you'll have to use connect
as a proxy command.