HowTo: Make umount Work with sshfs


sshfs is an easy way to provide file access to a remote system with ssh. On Ubuntu, all you need to install it (on the remote client, nothing to do on the server if it already runs ssh) is run:

sudo apt-get install sshfs

To make things easier, you can make an /etc/fstab entry with the settings to mount a remote directory: /home/chip/Remote-Home fuse umask=0,defaults,noauto,user 0 0

Now, to mount the directory I just type (from my home directory):

$ mount Remote-Home

The problem is that if I try to unmount the directory it fails:

$ umount Remote-Home
umount: /home/chip/Remote-Home mount disagrees with the fstab

The command you have to use is:

$ fusermount -u Remote-Home

But you can make umount work with two simple steps.

First (this is the trick), run:

$ sudo ln -s mount.fuse mount.fuse.sshfs

Then, make two changes to the fstab file. First, change the filesystem type (column three) from fuse to fuse.sshfs. Then, remove "sshfs#" from the first field. Now, it will look something like: /home/chip/Remote-Home fuse.sshfs umask=0,defaults,noauto,user 0 0

Now, everything will work as desired.

$ mount Remote-Home
$ umount -v Remote-Home umounted