Installation guide
Shfs stays for SHell File System. It consists of simple Linux kernel module (similar to smbfs, ftpfs or ncpfs) and userspace mount utility. The general usage:
$ shfsmount user@host /local/path user@host password: $ cd /local/path
Requirements
Client side:
- Linux 2.4.10+ (2.6) system
- tar, gzip, make
- C compiler (gcc) used while building your kernel (exactly the same version)
Remote (server) side:
- shell and number of utilities (chmod, chgrp, cut, dd, expr, ln, ls, mkdir, touch, wc, ...)
- or perl version 5+
Installation
Installation should be straightforward. First, download sources (shfs-x.xx.tgz).
- unpack the tarball
# tar -xzvf shfs-x.xx.tgz
- Check the top-level Makefile for KERNEL_SOURCES variable. It should contain path to your kernel directory (where include/linux resides).
- Important (kernel 2.4): check that your compiler is the same as used for compiling your kernel:
# 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). - make kernel module and shfsmount
# make
or (if you must specify the compiler):# make CC=compiler
- insert kernel module
# insmod shfs/Linux-2.x/shfs.o
- mount remote filesystem, and test it
# shfsmount/shfsmount user@hostname /mnt
- install shfs
# make install
- if you don't like it [unlikely ;-)], wipe it out
# make uninstall
- You can even make (debian/rpm) package and install it.
# make deb # dpkg -i ../shfs*.deb
or# make rpm # rpm -ivh ../shfs*.rpm
- There is also possibility to make a patch for kernel:
# cd shfs/Linux-2.x/ # make patch
If the patch is applied, there is no need for kernel module, just shfsmount have to be build and installed.
Usage
The shfsmount command has number of options, please refer to the manpage for more detailed description.
shfsmount was designed to have the same interface as the mount command. make install should have created the symlink /sbin/mount.shfs -> shfsmount so you will be able to call
mount -t shfs user@host /mnt
exactly 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 (unmount) remote dirs using shfs, set suid bit on /usr/bin/shfsmount and shfsumount. Security checks are similar to smbmount(8).
Examples
The simplest version (mount home dir of user at host):
shfsmount user@host /mnt/shfs
To specify remote directory:
shfsmount user@host:/tmp /mnt/shfs
To specify another port:
shfsmount -P 2222 user@host /mnt/shfs
To specify another ssh option:
shfsmount --cmd="ssh -c blowfish %u@%h /bin/bash" user@host:/tmp /mnt/shfs/
To make mount survive temporary connection outage (reconnect mode):
shfsmount --persistent user@host /mnt/shfs
Longer transfers? Increase cache size (1MB cache per file):
shfsmount user@host /mnt/shfs -o cachesize=256
To enable symlink resolution:
shfsmount -s user@host /mnt/shfs
To preserve uid (gid) (NFS replace mode :-)):
shfsmount root@host /mnt/shfs -o preserve,rmode=755
To see what is wrong (forces kernel debug output too):
shfsmount -vvv user@host /mnt/shfs