4

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

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
Gryu
  • 479
  • 1
  • 6
  • 14
jimiyash
  • 193
  • 1
  • 1
  • 6

3 Answers3

7
 ssh -o ProxyCommand='nc -x 127.0.0.1:30000 %h %p' user@destination.com

where 127.0.0.1:30000 is the socks5 proxy. Credit: Jethro Carr

ohho
  • 975
  • 8
  • 18
  • 34
3

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

Marcel G
  • 2,149
  • 14
  • 24
1

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

Ignacio Vazquez-Abrams
  • 45,019
  • 5
  • 78
  • 84