Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
    
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
show 2 more comments

migrated from superuser.com Oct 29 '10 at 7:25

This question came from our site for computer enthusiasts and power users.

4 Answers

 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

share|improve this answer
add comment

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

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

From http://www.perlmonks.org/?node_id=638101

ssh -o "connect -5 -S proxy.socks5.ip.name %h %p" target.ip.name
share|improve this answer
    
I saw that link as well, but I don't understand it. what is the -5 and -S option. And what is that target.ip.name? How would you use it in an example with an IP address for the server name. –  jimiyash Oct 29 '10 at 1:52
add comment

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

HTH

share|improve this answer
add comment

Your Answer

 
discard

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.