SSH over SOCKS proxy

Step-by-Step descriptions of how to do things.
Post Reply
User avatar
^rooker
Site Admin
Posts: 1465
Joined: Fri Aug 29, 2003 8:39 pm

SSH over SOCKS proxy

Post 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).
Jumping out of an airplane is not a basic instinct. Neither is breathing underwater. But put the two together and you're traveling through space!
Post Reply