Auto mounting using SSHFS and your /etc/fstab file (in Ubuntu)

Unfortunately, Ubuntu (Edgy and previous versions of Ubuntu) doesn’t seem to have a handy little script called mount.fuse which should come with the fuse-utils package.

This basically means it’s impossible to get Ubuntu to mount sshfs mounts upon startup (nicely), or using a nice and simple mount command like:

mount /my/sshfs/mount/point/

Anyway, personally, I find it really annoying. Yes, there are probably good reasons why they don’t include the script, but no I don’t care. Well, not until someone can tell me an easier/cleaner way of doing this.

First, you’ll need to:
sudo apt-get install sshfs
sudo apt-get install fuse-utils

Then, download mount.fuse (works with Edgy Eft Ubuntu, not sure about anything else!).. stick it in /sbin/ and then sudo chmod 777 /sbin/mount.fuse (or you could be more careful with those permissions).

You’ll want to add lines with this format to your /etc/fstab file:
sshfs#jrh@alf:/ /sshfs/alf fuse defaults,noauto,user 0 0

I’ve found there’s a lot of mount.fuse scripts out there, which expect the fstab lines to be in a different it’s quite important to use the right mount.fuse with the right fstab formatting!

Finally, if this happens when trying to mount:

fusermount: mount failed: Operation not permitted

try this.. it’ll allow your normal user to run fusermount (as root iirc):
sudo chmod 4755 /usr/bin/fusermount

It continues to amaze me how few people actually use this method of mounting with sshfs…it just seemed to make sense to me! Please leave a comment if you have a problem with this so I can add more info if needs be.

Leave a Reply