I am quite new to SSH and Ubuntu. I am trying to connect to a server (e.g. server1.com) via SOCKS5 proxy host (e.g. proxy1.com) for which username and password is already given. I am including the jump host directives and path to proxy username and password in the SSH config file but no luck until now as I am always getting an error:

unable to resolve proxy hostname

My .ssh/config file format is as below:

Host host1
HostName server1.com
Port 22
ProxyCommand ssh username:password@proxy.com portnum %h %p

And then I am using ssh host1 to initiate the session.

Can anyone give me the possible solutions?

2 Answers 2


ssh does not accept the password in the format you are trying nor it can use the SOCKS proxy itself. The proxy command should use a ncat:

ProxyCommand ncat --proxy socks4host --proxy-type socks4 --proxy-auth username:password proxy.com portnum

or similar.

  • I used nc command. I am getting broken pipe error now. Is it possible to use socks5 with ncat?
    – Mani
    May 23, 2017 at 13:18
  • Yes. Just have a look into the manual page to find out possible options.
    – Jakuje
    May 23, 2017 at 13:21

I've had some issues with the ncat command - looks like it implements the SOCKS5 protocol incorrectly and doesn't read part of the proxy server response, which then slips into ssh data and breaks ssh connection. I've used Ubuntu package connect-proxy instead.

$ sudo apt-get install connect-proxy
$ SOCKS5_PASSWD=proxypassword ssh -o "ProxyCommand=connect-proxy -5 -S proxyusername@proxy1.com %h %p" server1.com

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.