Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Say I have ssh access to machine "foo":

me@local: ssh user1@foo

And from there i can access "bar":

user1@foo: ssh user2@bar

With this setup, is there any way I can use sshfs to mount in my local machine a directory located in "bar"?

I don't have administrative access in "foo", so I can't use sshfs to mount a directory there.

share|improve this question
Is there no way to SSH directly into bar? – hexafraction Nov 12 '12 at 18:29
No, I can only access it through foo. – Znorg Nov 12 '12 at 18:38
up vote 1 down vote accepted

Yes, it's possible to use a ProxyCommand to tell SSH to use "foo" as a "jump point" to access "bar".

You need to set up things so that you can access "bar" directly from your shell. Once you're able to ssh bar without having to explicitly log into "foo" first, sshfs should work transparently (and it does, I just tested it).

To accomplish this, add stuff like this to .ssh/config:

Host bar
   ProxyCommand ssh foo nc -q0 %h %p
share|improve this answer
It worked, thanks! – Znorg Nov 13 '12 at 14:51

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.