Page 1 of 1

SSH over SOCKS proxy

Posted: Wed May 31, 2017 3:40 pm
by ^rooker
In order to connect to SSH over a SOCKS proxy server, you can use the following command:

Code: Select all

$ ssh -o ProxyCommand='nc -x myproxyserver.example.com:1080 %h %p' myuser@targetsshserver.example.com
You need to change the hostnames of the proxy- and ssh-server, as well as port and username to match your setup.
(Thanks to Captain Obvious for pointing that out ;))

Here is the same connection as .ssh/config example:

Code: Select all

Host mysshserver
    Hostname targetsshserver.example.com
    User myuser
    ProxyCommand nc -x myproxyserver.example.com:1080 %h %p

Successfully tested and used on Xubuntu 16.04.1 (Xenial Xerus) - ssh client v7.2.

Thanks to the posting 'SSH via SOCKS proxies' (by Jethro Carr).