Mounting remote filesystems using SSH and Debian

This post describes how to mount a remote filesystem through SSH using the shfs kernel module on a Debian Etch server. By doing this I can access the remote filesystem as if it was a local filesystem and also use my local tools and software.
This is a short description of how I made a remote filesystem accessible on my private server.

Download the needed software

# apt-get install shfs-source shfs-utils module-assistant

This step might not be needed on your system, but I didn’t have the needed software to build the kernel module

# module-assistant prepare

Use the module assistant to build the kernel module to match your local system (I use a 2.6 kernel but this whould work on a 2.4 kernel also)

module-assistant build shfs

Now you can install it

# module-assistant install shfs
Selecting previously deselected package shfs-module-2.6.18-5-686.
(Reading database ... 78212 files and directories currently installed.)
Unpacking shfs-module-2.6.18-5-686 (from .../shfs-module-2.6.18-5-686_0.35-6.2+2.6.18.dfsg.1-17_i386.deb) ...
Setting up shfs-module-2.6.18-5-686 (0.35-6.2+2.6.18.dfsg.1-17) ...

You might see some error messages but those are mostly harmless :) and can be ignored.
Now we can try to mount the remote filesystem

# mkdir /export/remotefs
# shfsmount user@remotesystem.com /export/remotefs
Password:

The remote filesystem should now be available after typing your password.

# cd /export/remotefs
# ls

You will now see all your files in the remote filesystem as if they were on your local machine.
To unmount your filesystem

# cd /
# umount /export/remotefs

This post could have been extended to use passwordless