Monday, June 23, 2008

sshfs - mount a filesystem when you only have ssh access

sshfs is one of the most useful tools I've found recently. Basically it allows you to mount a filesystem, let's say your home directory, on a remote machine, just by using ssh. It uses FUSE and sftp in the background, but you don't need to worry about that. If you can ssh, you can mount the remote filesystem.

By default it only allows root to mount, but all you have to do is add yourself to the "fuse" group and re-login(or sudo -yourloginid if you're lazy or don't want to lose all your windows) and you can start using it:
mount remotemachine:/your/home/directory /local/mount/point

to unmount it just do:
fusermount -u /local/mount/point

It's excellent when you don't have NFS/samba available.

3 comments:

Damian said...

Did you get it to work with public key handshakes? I got turned off it when I first saw it because we were into passwords-in-fstab territory.

Tibor Incze said...

Yep, it works with public key. Even if that's the only auth method you allow. There's a bit of a catch-22 there until you add yourself to the "fuse" group, but after that it's nice and smooth.

Damian said...

Just got it all working on my Ubuntu 8.10 laptop. I decided to use it instead of NFS to my home server, which should be convenient when away from home.