Install Software
tux@earth:~$ sudo apt-get install encfs fuse-utils
tux@earth:~$ sudo modprobe fuse
load the kernel module permanently
tux@earth:~$ sudo vi /etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
....
fuse
Add yourself or the user which use the encrypted filesystem to the fuse group
tux@earth:~$ sudo adduser <USERNAME> fuse
Create a directory where your encrypted stuff will be stored
tux@earth:~$ mkdir ~/crypt
Create a mountpoint
tux@earth:~$ mkdir ~/uncrypt
Create the encrypted system and mount it
tux@earth:~$ encfs <folder to mount> <mount point>
For this example
tux@earth:~$ encfs /home/$LOGNAME/crypt /home/$LOGNAME/uncrypt
Note that encfs wants absolute paths, i.e. starting with a /
Do the work
Put some files in your ~/uncrypt folder and look in the ~/crypt one: they will show up there, encrypted.
Unmount the encrypted filesystem
tux@earth:~$ fusermount -u /home/$LOGNAME/uncrypt
Statr/Stop script to mount/umout a encfs folder
#!/bin/bash
# ***********************************************************
# File: mountcryptfs.sh
# Date: 2009-01-27 10:37:44
# Author: Marko Schulz - <info@tuxnet24.de>
# Description: Start/Stop script to mount/umount a folder with encfs.
# ***********************************************************
# Absolute path to the directory which sshould be mounted.
folder="/home/${LOGNAME}/crypt"
# Absolute path to the mount point directory.
mpoint="/home/${LOGNAME}/uncrypt"
# ***********************************************************
# Program action
# Create $folder and $mpoint if not exist.
[ ! -d "$folder" ] && mkdir -p $folder
[ ! -d "$mpointr" ] && mkdir -p $mpoint
# Get error and exit the program if no kernel module 'fuse' is loaded.
if [ "$( lsmod | grep 'fuse' | grep -v 'grep' | awk '{print $1}' )" != "fuse" ]; then
echo "ERROR: No module 'fuse' is loaded."; exit 1
fi
# ready, stady go ;-\)
case "$1" in
start)
if ! mount | grep -q $mpoint; then
encfs $folder $mpoint
fi
;;
stop)
if mount | grep -q $mpoint; then
fusermount -u $mpoint
fi
;;
restart)
$0 stop
$0 start
;;
status)
if mount | grep -q $mpoint; then
echo "$folder is mounted on $mpoint"
else
echo "$folder is NOT mountet"
fi
;;
*\)
echo -e "\aUsage: $0 {start|stop|restart|status}"; exit 1
;;
esac
# ***********************************************************
# EOF