Skip navigation.
Home
Now Shipping Version 7.0

Creating An Encrypted File System With EncFS

Jon Du Quesne's picture

Posts: 5513

A couple weeks ago I decided that I wanted to learn how to set up an encrypted file system in Mepis. I did a search and found that one package that allows this is called EncFS. I tried loading it and using it and this resulted in total failure. Now I have figured out how to do it! What follows are the instructions for installing and using EncFS, the Encrypted File System.

Rather than creating an encrypted partition, EncFS allows you to create one or more encrypted directories in your own user-space. Once I got the steps down I was pretty happy Smiling

Installation
The first article that I read on EncFS is on O'Reilly's Linux Development Center:
Userspace Filesystem Encryption with EncFS http://www.linuxdevcenter.com/pub/a/linux/2005/04/14/encfs.html

The wiki created by the author of EncFS is located at:
http://arg0.net/wiki/encfs

In order to install EncFS you will need two other packages: fuse and rlog. Although EncFS and rlog can be loaded through synaptic or apt-get, fuse must be loaded from source-code and compiled. This must be done first.

You can find fuse at:
http://fuse.sourceforge.net/

Download the file fuse-2.3.0.tar.gz to some temporary area, say /home/user/tmp.

Change to the tmp directory and uncompress the file:

$ cd tmp
$ tar xvzf fuse-2.3.0.tar.gz
$ cd fuse-2.3.0

Next, the commands below must be done as root:

# ./configure
# make
# make install

Next, make the fuse file system available. Do the following as root:

# modprobe fuse 

Next, you need to install rlog and encfs. You can do that through synaptic or apt-get. To install them through apt-get perform the following commands as root:

# apt-get install rlog encfs

Using EncFS

Using encfs is fairly easy. You need to create two directories in your /home/user directory. The first will become the encrypted directory. The second will be a mount-point for the encrypted directory. These directories can be called anything you like.

Once the encrypted file system has been mounted you put things in and out of the mounted directory like any directory. All of these commands can be done as a regular user. So, for example, create the encrypted directory:

$ mkdir /home/user/encrypt

And, create the mount point:

$ mkdir /home/user/decrypt

To use the directory, first it must be mounted. Even though you are the owner of the directories, use full path names for both directories.

$ encfs /home/use/encrypt /home/user/decrypt

The first time it's used you will be prompted for a password. This can be a passphrase.

Once mounted, create directories and files inside of /home/user/decrypt. If you look in the encrypt directory you will find junk Smiling

When you unmount and close the encrypted file system the files become unreadable:

$ fusermount -u /home/user/decrypt

That's all there is to it!

Jon

Addendum:

I found that once you shut down the system that the fuse loadable module did not "stick". I have added the following items to my system. These changes must be done as user root.

# echo "modprobe fuse" > /etc/init.d/fuse
# chmod +x /etc/init.d/fuse
# ln -s ../init.d/fuse /etc/rcS.d/S47fuse