Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have successfully setup a tunnel over SSH on linux mint, and can browse the web.

However, when I try to ssh using the same port, I get:

Couldn't establish connection to proxy: Network is unreachable ssh_exchange_identification: Connection closed by remote host

In my mate-network-properties I have selected manual proxy configuration, and socks host is 127.0.0.1

So why doesn't ssh use that proxy information, and can I make it use said proxy?

share|improve this question
2  
How exactly have you set up your tunnel? Post your configuration files. –  Gilles Sep 21 '12 at 23:21
add comment

3 Answers

up vote 5 down vote accepted

You don't need to tunnel ssh. You can ssh to the intermediary host then ssh to anywhere else you need.

You can even do it in a single command by forcing allocation of a pseudo-tty using the -t flag:

me@inside$ ssh -t intermediary ssh external
Last login: Fri Sep 21 14:13:25 2012 from intermediary
me@external$ logout
Connection to external closed.
Connection to intermediary closed.
me@inside$ 

The only down side is that you have multiple SSH sessions. But I can't really see why that would be a problem.

share|improve this answer
add comment

Agree with @bahamat, just ssh over ssh directly, without using the SOCKS proxy. There is a way to do it automatically through .ssh/config (requires netcat/nc on the ssh middleman host):

Host my-host-behind-the-firewall
ProxyCommand ssh my-ssh-front-server exec nc %h %p 2>/dev/null

Now you can just

ssh my-host-behind-the-firewall

and it just works. Especially convenient if you have password-free access to the front server using keys.

http://blog.ociru.net/2013/09/24/ssh-proxycommand/

share|improve this answer
add comment

First instance:

# ssh -D 1080 username@first.host

The second instance will use this socks5 proxy:

$ cat /etc/tsocks.conf
....
server = 127.0.0.1
server_port = 1080

Launch,

$ tsocks ssh username@second.host
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.