SHFS stays for SHell File System. It is a simple Linux kernel module partially based on Florin Malita's ftpfs. Using this module, you can connect remote filesystems into your local filesystem tree.
$ shfsmount user@host /local/path user@host password: $ cd /local/path
With some quirks you can even use automounter and access your remote data just like the local ones. Imagine:
# ssh-agent # cd /shfs/user%host # ls -l drwx--x--x 7 user group 4096 May 17 15:26 WWW drwx------ 5 user group 4096 May 29 18:27 bin drwx------ 3 user group 4096 May 31 16:11 mail drwxr-xr-x 5 user group 4096 Apr 13 12:02 src
Just like NFS or ftpfs, but in a secure and wide-compatible way.
To say the truth, it is our work for Operating Systems course at Charles University. It is just hack, but works, at least for me :-).
Installation should be straightforward. First, download sources (shfs-x.xx.tgz).
# tar -xzvf shfs-x.xx.tgz
# gcc --version 2.96 # cat /proc/version Linux version 2.4.18 (root@host) (gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98))If these versions differ, check for your configuration, how to call the kernel compiler (e.g. gcc-3.2). You will have to pass this to make (make CC=gcc-3.2).
# makeor (if you must spcify the compiler):
# make CC=compiler
# insmod shfs/shfs.o
# shfsmount/shfsmount user@hostname /mnt
# make install
# make uninstall
# make deb # dpkg -i ../shfs*.debor
# make rpm # rpm -ivh ../shfs*.rpm
The shfsmount command has a number of options. You have seen the simplest form in the
Installation section above.
General usage is:
shfsmount [options] [user@]hostname[:port][/root] mount_point -o mount_options
Options:
-r | Use rsh instead of ssh. |
-O option | Specify ssh (rsh) option (e.g. -O "-c 3des" == ssh -c 3des). | -u | Execute ssh as this user (root only) |
-v | Print version of shfsmount. |
user | Log in using this user name. |
hostname | Specify remote host |
port | Use this port to log in (ssh). |
root | Remote directory to became root of the new mounted tree. |
Mount options
nocache | Disable read-ahead and write-back cache. |
generic | Do not use optimised shell command set. |
preserve | Preserve uid/gid (root only). |
uid=id | Owner of all files/dirs on mounted filesystem (root only). |
gid=id | Group of all files/dirs on mounted filesystem (root only). |
rmode=mode | Root dir mode. |
suid, dev | see mount(8) (root only) |
ro, rw, nosuid, nodev, exec, noexec | see mount(8) |
Shfsmount was designed to have the same interface as the mount command. make install should have created symlink /sbin/mount.shfs -> shfsmount so you will be able to call
# mount -t shfs user@host /mntexactly as with other filesystems. You can even use automounter to connect to server automatically (think about using ssh keys).
If you would like all users to be able to mount remote dirs using shfs, set suid bit on /usr/bin/shfsmount and /usr/bin/shfsumount. Security checks are similar to smbmount.
Generic shell file operations (currently used on all systems except Linux) use very slow write command. For more info on this topic see internal docs.