Home

Debian/Ubuntu Tips & Tricks

Debuntu.org: .deb packages, Unix/Linux Tutorials and Articles.

Sponsors




Tips


Google Products


Mounting a fuse Filesystem from /etc/fstab

Earlier on, I showed how-to mount a remote filesystem with fuse, using a remote partition accessible by SSH. Since version version 2.4.0, it is possible to use fstab to mount those kind of partition.

The current version installed on ubuntu dapper is fuse-utils-2.4.2. Unfortunately, /sbin/mount.fuse is not included in the package. I've recompiled it, submitted to revu, hopefully it is going to make its way up to the main repository. In the meanwhile you can get it from here.

FUSE comes in 4 packages:

  • fuse-source: Filesystem in USErspace (source for kernel module)
  • fuse-utils: Filesystem in USErspace (utilities), the package we are going to use here.
  • libfuse2: Filesystem in USErspace library
  • libfuse-dev: Filesystem in USErspace (development files)

EDIT: A newer fuse .deb version is available from Debuntu .deb repository , installing fuse package from the repository will include new features.

Ok, let's go to it. The packages we are going to need are fuse-utils and sshfs. Download fuse-utils_2.4.2-0ubuntu3_i386.deb and install it:

:~$sudo dpkg -i /path/to/fuse-utils_2.4.2-0ubuntu3_i386.deb

Install sshfs as well:

:~$sudo apt-get install sshfs

Now, taking the exemple used in How to: Mount a remote filesystem using SSH, SSHFS and FUSE, we are going to modify /etc/fstab :

sshfs#my-remote-user@my-remote-host:/home/my-remote-user /my-local-filesystem/remotefs fuse defaults 0 0

EDIT: Since Fuse 2.5.3, new parameters such as user and noauto can be used in fstab, so changing the previous line to:

sshfs#my-remote-user@my-remote-host:/home/my-remote-user /my-local-filesystem/remotefs fuse user,noauto 0 0

will not mount the filesystem automatically during boot (noauto) and will let a non-privileged user (but belonging to fuse group) to mount the filesystem from the command line.
And that's it, you can now mount your file system, just like other filesystem in /etc/fstab, here:

:~$sudo mount /my-local-filesystem/remotefs
my-remote-user@my-remote-host's password:

:) .

How to use tsocks on sshfs when in fstab

Hi
I really likes the article, but i miss a little feature.
When i'm at my university i'm behind a socks proxy. Therefore i really would like to be able to either make the fuse connect through that proxy, or use tsocks to route all sshfs connections through the proxy.

I really would like you comment's on that.

Andreas

Check it out easy!

http://wiki.ubuntuusers.de/FUSE/sshfs

requirements:
1. a line fuse in /etc/modules
2. the package sshfs installed

3. a line in /etc/fstab
sshfs#username@yourserver:/pathonserver/ /yourmountdir fuse uid=1003,gid=100,umask=0,allow_other 0 0

and now the best an easiest:
4. a line in menu->system->settings->sessions->startup
sshfs username@yourserver:/pathonserver/ /yourmountdir

That's awful -> with starting the session, there is a password-question!!!!

It's more easy and awful!!!! (6.06 Dapper Drake)

http://wiki.ubuntuusers.de/FUSE/sshfs

requirements:
1. a line fuse in /etc/modules
2. the package sshfs installed

3. a line in /etc/fstab
sshfs#username@yourserver:/pathonserver/ /yourmountdir fuse uid=1003,gid=100,umask=0,allow_other 0 0

and now the best an easiest:
4. a line in menu->system->settings->sessions->startup
sshfs username@yourserver:/pathonserver/ /yourmountdir

That's awful -> with starting the session, there is a password-question!!!!

mount.fuse

where was /sbin/mount.fuse you said?


You get it from fuse-utils

You get it from fuse-utils from debuntu deb's repository
Debuntu


?--------- ? ? ? ? ?

you have to mount your remote fs without sudo!

just type: mount /media/yourRemDir

but dont forget to add the user/users in fstab. My fstab looks like this:

sshfs#myusername@myserver.de:/home/myusername     /media/UniAccount       fuse            users,noauto    0       0


Thanks a lot!!! This is exact

Thanks a lot!!! This is exactly what I was looking for!


Hi ElMacovich, That was a

Hi ElMacovich,

That was a pleasure ;).

Thks for your support.


Hi Chantra. I use Dapper Drak

Hi Chantra. I use Dapper Drake on an AMD64 system. So I cannot use your deb file. Is there a workaround to get the mounting done automatically with or without fstab?


Thank you so much for providi

Thank you so much for providing these files; I would have banged my head on the desk for hours ;)

I do have one quirk that wasn't covered in the howto: when I mount via command-line, everything is fine, but when I mount via fstab, only root is able to access the folder :(

I have done chown, chgrp, chmod - set the fmask, dmask, uid, gid in fstab: still the same problem.
Oddly, when I have uid and gid set;
'ls -l' shows "?--------- ? ? ? ? ? DIRECTORY"
and 'sudo ls -l' shows "drwxrwxrwx 1 MyUID MyGID 480 2006-01-22 16:41 DIRECTORY"

I'm stumped for now


Ok, I have resolved it, thoug

Ok, I have resolved it, though it may not be optimal:

Added the "user" parameter that's now supported as of the debuntu version.
(I also added noauto)

Now I can do 'mount /media/DIRECTORY' and 'umount /media/DIRECTORY' and I have proper permissions!

Thanks again


Hi Josh43, Thanks for that

Hi Josh43,

Thanks for that,

I will update my post according to this :).
You can also use the users parameter, but that is not really safe :).

cheers


Just found out that the full

Just found out that the full path of the remote directory might need to be specified and shell short forms don't work.

For example
$ sshfs user@remote-host:~/ remotefs
might not work, while
$ sshfs user@remote-host:/home/user remotefs
works.


hi natarajan, thanks for t

hi natarajan,

thanks for this point. Actually, I forgot to mention it but I remember that I had to supply the full path prefix and not only ~/xxx .