Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I can access a server A with SSH, and from there I can access server B, but I can't access B directly.

Is it possible to open a Nautilus folder in server B by clicking in PlacesConnect to Server?

share|improve this question
Quick question... in relation to server 'A', where is server 'B'? On an internal network which Server 'A' shares with Server 'B', or on a separate external network/IP? Also, is Server 'B' restricting connections to it to a selected group of IPs, say the iP that Server A has? –  Thomas W. Feb 6 '12 at 15:55
add comment

2 Answers 2

up vote 5 down vote accepted

Yes that is possible. I have the following setup which works, but there might be easier ones.

In the file ~/.ssh/config, add the following lines:

ControlMaster auto
ControlPath   /home/yourusername/.ssh/tmp/%h_%p_%r
Host A
  HostName hostname.of.server.a

Host B
  ProxyCommand ssh -e none A netcat -w 5 hostname.of.server.b 22

You have to replace yourusername, hostname.of.sever.a and hostname.of.server.b After that, you can (in Nautilus) go to Places->Connect to Server (its actually File->Connect to Server on my machine). And then enter B. That should be all to see the server B.

share|improve this answer
add comment

One thing to try is to add this to .ssh/config:

Host B
  ProxyCommand ssh A nc -q0 %h %p
  ForwardAgent yes

Once this is in place, you should be able to ssh B directly, and SSH will know to "bounce" the connection through A first.

When this is working, try Nautilus the way you describe and see if the proxying setup works for it as well.

share|improve this answer
I can't post comments yet so I'm writing here. roadmr reply worked perfectly for me but I had to change "-q0" with "-p0". Looking at the man nc, -q should be the waiting time and -p should specify the source port. I don't know why that should be 0, but it worked :) –  luca May 8 at 12:48
add comment

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.