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 format..so 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.

7 thoughts on “Auto mounting using SSHFS and your /etc/fstab file (in Ubuntu)

  1. Nice guide. I too love sshfs.

    Since your link to your mount.fuse is dead, here’s an easy way to gain mount.fuse in the path for your readers:

    sudo ln -s /usr/bin/fusermount /sbin/mount.fuse

  2. Ubuntu 6.10
    While looking in to this, i noticed that in /sbin, where you say to put your script, there was a broken link for mount.ntfs-fuse, pointing to /usr/sbin/ntfsmount.

    A locate of ntfsmount showed that it existed in /usr/bin/ntfsmount, so i simply made a link

    ln -s /usr/bin/ntfsmount /usr/sbin/ntfsmount

    which fixed the broken link, and now my fstab file works just fine with a mount type of ntfs-fuse (as shown in the man example).

    Thought i would share. 🙂

  3. Thanks. I upgraded Ubuntu to vers. 6.10 … then, automount via fstab didnt work anymore. your thread was exactly what I was looking for. grande!

Leave a Reply

Your email address will not be published. Required fields are marked *