Mount a folder or filesystem over ssh in Debian

This is defenitely a trivial thing, but always nice to find again after a reinstall of my debian box (I like to play with that). Anyway, here we go again;

We start by installing the sshfs package with its dependancies:

   sudo aptitude install sshfs

Let it be installed. After the install you will find that it does not yet work as promissed. We still have to change some rights to make it possible for a normal user to mount the drive. Therefore we open the file ‘groups’ in our favorite editor:

   sudo gedit /etc/group

Here we search for the line that says something like “fuse:x:117:”. At this line we add the username of the user we want to give these rights. In my case this would become:

   fuse:x:117:patrick

Now it is time to save the file and to check if it worked. First we need to restart the system (I am sure there is another way, but I just do not know it).

Now we try it. I will try to mount the home directory on an other computer in a folder on this computer. Of course, the other computer (or server) is open to receive ssh.  For this I would issue the command:

   sshfs <ip address>:<path to folder> <path to where the folder should be mounted>
   sshfs 192.168.2.201:/home/patrick /home/patrick/Server

Of course, the ip address/computer address, and the folders will be different on your machine. Also, you might want to log in with a different username (I can use my standard username for both machines).

Anyway, after pressing “Enter” I have to provide ssh with my password, but this is also dependend on the ssh configuration on the other machine.

To unmount, use this:

   fusermount -u /home/patrick/server

OR this:

   sudo umount /home/patrick/server