Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am really struggling with this.

My host (A) is behind a proxy/firewall (PF) and needs to connect to host H.

The proxy has HTTP/FTP/SOCK proxy configured and I have no issue to configure in web browser, wget etc.

But when I use...

ssh H //to connect my host 

I have no success to pass over the proxy. It seems to try to connect directly instead of going via the PF.

I am using Ubuntu 12.10.

share|improve this question
up vote 5 down vote accepted

ssh has no native SOCKS client support, you need to use a ProxyCommand for that, for instance with socat:

ssh -o ProxyCommand='socat - SOCKS4A:myproxy:%h:%p,socksuser=nobody' user@host

Or use things like tsocks or dante's socksify to transparently use SOCKS for TCP traffic.

For SOCKS5 with socat 2:

ssh -o ProxyCommand='socat - "SOCKS5:%h:%p|tcp:myproxy:1080"' user@host

For HTTP Proxy CONNECT method with socat 2:

ssh -o ProxyCommand='socat - "PROXY:%h:%p|tcp:myproxy:80"' user@host
share|improve this answer

Check Corkscrew or Proxytunnel (and be aware that tunnelling SSH through a proxy be forbidden by local policies in some networks).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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