Installation guide

Shfs stands for SHell File System. It consists of simple Linux kernel module (similar to smbfs, ftpfs or ncpfs) and a userspace mount utility. The general usage:

$ shfsmount user@host /local/path
user@host password:
$ cd /local/path

Requirements

Client side:

Remote (server) side:

Installation

Installation should be straightforward. First, download sources (shfs-x.xx.tgz).

  1. unpack the tarball
    # tar -xzvf shfs-x.xx.tgz
    
  2. Check the top-level Makefile for KERNEL_SOURCES variable. It should contain path to your kernel directory (where include/linux resides).
  3. 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).
  4. make kernel module and shfsmount
    # make
    
    or (if you must specify the compiler):
    # make CC=compiler
    
  5. insert kernel module
    # insmod shfs/Linux-2.x/shfs.o
    
  6. mount remote filesystem, and test it
    # shfsmount/shfsmount user@hostname /mnt
    
  7. install shfs
    # make install
    
  8. if you don't like it [unlikely ;-)], wipe it out
    # make uninstall
    
  9. You can even make (debian/rpm) package and install it.
    # make deb
    # dpkg -i ../shfs*.deb
    
    or
    # make rpm
    # rpm -ivh ../shfs*.rpm
    
  10. 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 a number of options, please refer to the manpage for a 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 an automounter to connect to a server automatically (think about using ssh keys).

If you would like all users to be able to mount (umount) remote dirs using shfs, set the 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