I am using the ssh to try to connect to a server behind on remote network. That server is behind a socks5 proxy on the same network. The port of the proxy server is 1080 and the ssh port is 22. However this fails. The debug says that connection is refused on port 22.

I thought it was necessary to install corkscrew so it installed it with homebrew and used this link as a reference: http://meinit.nl/ssh-through-a-proxy-from-your-apple-mac-os-x

debug1: Reading configuration data /Users/jason/.ssh/config debug1: Applying options for XXX.XX.XX debug1: Reading configuration data /etc/ssh_config debug1: Executing proxy command: exec /usr/local/bin/corkscrew proxy.server 1080 XX.XXX.XX.XX 22 debug1: identity file /Users/jason/.ssh/identity type -1 debug1: permanently_drop_suid: 501 debug1: identity file /Users/jason/.ssh/id_rsa type 1 debug1: identity file /Users/jason/.ssh/id_dsa type 2

  • I am not sure if this would be better on server fault, or maybe even the ubuntu stack exchange. – jimiyash Oct 29 '10 at 1:10
  • Wait, are you trying to connect to a SOCKS proxy, or are you trying to create a SOCKS proxy? – Ignacio Vazquez-Abrams Oct 29 '10 at 1:16
  • On the remote server network there is a socks5 proxy server and I am trying to connect to a server behind that socks5 proxy server. I am not trying to create one. – jimiyash Oct 29 '10 at 1:24
  • Corkscrew is for HTTP proxies, not SOCKS proxies. – Ignacio Vazquez-Abrams Oct 29 '10 at 2:41
  • @Ignacio - ok. could you give me a little more complete answer on how to use ssh connect? – jimiyash Oct 29 '10 at 2:46
 ssh -o ProxyCommand='nc -x %h %p' user@destination.com

where is the socks5 proxy. Credit: Jethro Carr

| improve this answer | |

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

| improve this answer | |

-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.

| improve this answer | |
  • Thank you. I updated the question to make it a little clearer. – jimiyash Oct 29 '10 at 2:34

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.