Super User is a question and answer site for computer enthusiasts and power users. 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

I would like to mount a remote file system (A) using SSHFS, but sometimes I have IP address, access from which is not allowed. So my plan is to access it via another machine (B) in that network. Do I need to mount A on B and then to mount B (and A) on my local computer? Is there a better way to do it?

Update

Just to clarify the procedure:

First, I make a tunnel

ssh -f user@machineB -L MYPORT:machineA:22 -N

And then I mount the remote file system

sshfs -p MYPORT user@127.0.0.1:/myremotepath /mylocalpath

Is it correct?

How do I destroy the tunnel when I am done?

share|improve this question
1  
better way to set up tunnel is to have connection to B from GNU screen window using ssh user@machineB -L 2222:machineA:22 -N so you can easily kill it with ^C – edk May 9 '10 at 16:03
up vote 3 down vote accepted

yeah tunneling. You connect machine B, create local tunnel (-L) to SSHd port of machine A then sshfs to localhost to the port of newly created tunnel.

share|improve this answer
    
Is the following command the right way to do that? ssh -f user@machineB -L 25:machineA:25 -N – Andrei May 8 '10 at 14:00
1  
yes if you have sshd listening to port 25 on machine A. then you'll just have to sshfs -p 25 user@127.0.0.1:/path /localpath – edk May 8 '10 at 14:20
1  
Aha, so for default ssh setup I need ssh -f user@machineB -L 22:machineA:22 -N, right? – Andrei May 8 '10 at 15:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .