next up previous
Next: Getting information Up: Linux/UNIX Previous: File locations

Mounting remote UNIX/Linux directories via ssh tunnelling

There is an easy way to mount remote directories on your local Linux box so that the files appear to be local and can be worked with as if they were local (e.g., opening files, copying, etc.). Use the shfs package, which provides shfsmount and shfsumount binaries for mounting and unmounting directories. These binaries tunnel through ssh so that everything is completely secure, removing the need for SAMBA or something similar to be running on the file server/remote machine. In my Linux Redhat 9 installation, it took some monkeying to get shfs to install properly. First, shfs needs to work with the current version of the kernel, so it requires that the kernel-source package for the current kernel be installed. I also needed to make a couple changes to the Makefile when installing the package, namely defining KERNEL=$(uname -r) and KERNEL_SOURCES=${ROOT}/usr/src/linux-2.4.

You will also need to chmod 4555 /usr/bin/shfs{u}mount so that individual users can access the binaries.

If you update your kernel, you'll need to reinstall shfs, along the following lines:

>cd /opt/shfs-0.35

>make clean # this may not be necessary

>make # this may not be necessary

>make install

>chmod 4555 /usr/bin/shfs{u}mount

I believe the sshfs package may be a good alternative, possibly without the need to modify the kernel, but I haven't explored this yet.

Keywords: remote mounting, ssh, tunneling

Last modified: 4/2/06.


next up previous
Next: Getting information Up: Linux/UNIX Previous: File locations
Chris Paciorek 2006-04-02