This article is written from a Red Hat 9 perspective, should be easily applicable to other *nix.

Have you used NFS to share files accross networks? Have you ever wanted to do the same thing more securely?

If so you need SHFS

SHFS is a secure file system that uses SSH to provide a method for mounting an external file system securely from any system running SSHD

Interested? Good then read on.

First you will need to obtain the source and build a kernel module from SHFS on Sourceforge

su to root and then unpack the file with tar -xzvf shfs-0.32pre2.tar.gz

This will create a shfs-0.32pre2 directory and in there you will find installation instructions Read and understand these.

The following :

# Check shfs/Makefile and the include path (-I switch). It should contain path to include directory of your current kernel.
# 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).


Should be checked, but for RH9 there were no problems here.

cd shfs-0.32pre2
make
insmod shfs/shfs.o
make install

all worked without a hitch on RH9

Okay, so how do you use it.

First if non root users need to be able to mount file systems using this method you need to do :
chmod u+s /usr/bin/shfsmount
chmod u+s /usr/bin/shfsumount


Okay suppose you have an account on remote_machine.net and that account's home directory is /home/my_account and you want to mount it on your local machine on /mnt/remote (mkdir /mnt/remote if it doesn't exist) then type:
mount -t shfs my_account@remote_machine.net /mnt/remote

You will be prompted for your password, unless you have enabled key authentication on this account

ls /mnt/remote and presto - a secureley mounted remote file system.

You can also place entries into /etc/fstab

my_account@remote_machine [tab] /mnt/remote [tab] shfs [tab] defaults


to make mounting easier. This also works with automount as well.

Hope people find this useful.