Wednesday, February 22, 2006

Fuse and SSH-Mount(SSH FS)

Regular users of Samba protocol suite(Linux/Unixes way to access and be part of Microsoft Network Sharing protocol) might understand the importance of a mounted filesystem. Basically after mounting the filesystem you can access the files on the filesystem as if they were on your own system under the mount point.
This concept is also the basic of NFS mount which is very widely used for sharing a Disk across multiple remote systems. Users just mount some directory of the NFS share on their system and use the files on the remote system as local files.

Sometimes its irritating when you are asked root privelleges to mount file Systems on your system. I was myself puzzled by the super user requirement for mounting files, If you are puzzled too, go ahead read the book "Design of the Unix Operating Sytem" by Maurice J Bach.

But there is a solution to the above requirement, its called FUSE, which is acronym for File System in User Space.
I chose to ignore the implementation details of the thing and just use it, Its pretty interesting and useful.
The important idea is that it doesn't require any root privelleges during the operation of mounting and unmounting. A large number of Filesystems based on FUSE have been developed. Among others the some interesting ones are FlickrFS, SSHFS, GmailFS, and SMBNetFS.(Well there are so many of them, you gotta checkout which one is of use to you)

I tried playing around with SSH FS, its pretty cool. I was able to mount a system over SSH protocol, i.e I can just see the files as if they were on my own system after 'mounting' my login's home directory in to local directory. You can play audio files over a SSH server !!! After installation all that you need to do it. (A.B.C.D is my ip address)
[vardhman@localhost ~]$ mkdir ~/labpc
[vardhman@localhost ~]$ sshfs-fuse-1.4/sshfs A.B.C.D: ~/labpc
vardhman@A.B.C.D's password:
[vardhman@localhost ~]$ cd ~/labpc/
I then tried the smbnetfs filesystem, its wonderful to. Here are the command
[vardhman@localhost ~]$ mkdir ~/winmount
[vardhman@localhost src]$ ./smbnetfs ~/winmount
[vardhman@localhost src]$ cd winmount/A.B.C.D
[vardhman@localhost A.B.C.D]$ ls
dump #
.. other files shared on machine A.B.C.D

Basically all you need after creating a mount point is to give cd /ip address and wooo you see the shares are if you smbmounted them. I would love to know if we can write a script in konqueror to automate this task then smb://ip address is given in the address bar.

I heard FlickrFS and GmailFS are cool too, I do plan to try them soon.

By the way unmounting all of them is simple just give the command
fusermount -u < mountpoint > </mountpoint >
I am told fuse support is coming inbuild in kernel after 2.6.14, In my kernel the one with FC4 it was not working by default. I had to give the --enable-kernel-module option while compiling, make install in to defualt prefix does require root previlleges and so does the modprobe fuse command do. Also you might need to set the LD_LIBRARY_PATH variable. Installation is pretty straight forward and simple. I am sure it will be turnout to be very useful.

1 comment:

  1. yeah, fuse rocks ...

    what i'd like to see is a distributed peer to peer filesystem ...