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?

link|improve this question

79% accept rate
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
feedback

1 Answer

up vote 1 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.

link|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
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
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.