There is a new version of this tutorial available for Fedora 18.

This tutorial exists for these OS versions

On this page

  1. Encrypt Your Data With EncFS (Fedora 17)
    1. 1 Preliminary Note
    2. 2 Installing EncFS
    3. 3 Using EncFS
    4. 4 Links

Encrypt Your Data With EncFS (Fedora 17)

Version 1.0
Author: Falko Timme
Follow me on Twitter

EncFS provides an encrypted filesystem in user-space. It runs without any special permissions and uses the FUSE library and Linux kernel module to provide the filesystem interface. It is a pass-through filesystem, not an encrypted block device, which means it is created on top of an existing filesystem. This tutorial shows how you can use EncFS on Fedora 17 to encrypt your data.

I do not issue any guarantee that this will work for you!


1 Preliminary Note

I'm using the username falko on my Fedora 17 system in this tutorial.


2 Installing EncFS

Become root first:


EncFS can then be installed as follows:

yum install fuse-encfs

Exit the root shell:


You should now take a look at the EncFS man page to familiarize yourself with its options:

man encfs


3 Using EncFS

I will now create the directories encrypted and decrypted in my home directory:

mkdir -p ~/encrypted
mkdir -p ~/decrypted

The decrypted directory acts as the mount point for the encrypted directory. To mount ~/encrypted to ~/decrypted, simply run:

encfs ~/encrypted ~/decrypted

If you run this command for the first time, the EncFS setup is started, and you must define a password for the encrypted volume:

[falko@localhost ~]$ encfs ~/encrypted ~/decrypted
Creating new encrypted volume.
Please choose from one of the following options:
 enter "x" for expert configuration mode,
 enter "p" for pre-configured paranoia mode,
 anything else, or an empty line will select standard mode.
 <-- p

Paranoia configuration selected.

Configuration finished.  The filesystem to be created has
the following properties:
Filesystem cipher: "ssl/aes", version 3:0:2
Filename encoding: "nameio/block", version 3:0:1
Key Size: 256 bits
Block Size: 1024 bytes, including 8 byte MAC header
Each file contains 8 byte header with unique IV data.
Filenames encoded using IV chaining mode.
File data IV is chained to filename IV.
File holes passed through to ciphertext.

-------------------------- WARNING --------------------------
The external initialization-vector chaining option has been
enabled.  This option disables the use of hard links on the
filesystem. Without hard links, some programs may not work.
The programs 'mutt' and 'procmail' are known to fail.  For
more information, please see the encfs mailing list.
If you would like to choose another configuration setting,
please press CTRL-C now to abort and start over.

Now you will need to enter a password for your filesystem.
You will need to remember this password, as there is absolutely
no recovery mechanism.  However, the password can be changed
later using encfsctl.

New Encfs Password:
 <-- yoursecretpassword
Verify Encfs Password: <-- yoursecretpassword
[falko@localhost ~]$

Make sure you remember the password because there's no way to recover your encrypted data if you forget the password!

You should now find the EncFS volume in the outputs of

[falko@localhost ~]$ mount
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime,seclabel)
devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=504616k,nr_inodes=126154,mode=755)
devpts on /dev/pts type devpts (rw,relatime,seclabel,gid=5,mode=620,ptmxmode=000)
tmpfs on /dev/shm type tmpfs (rw,relatime,seclabel)
tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755)
/dev/mapper/VolGroup-lv_root on / type ext4 (rw,relatime,seclabel,data=ordered)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)
tmpfs on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,seclabel,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct,cpu)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=23,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
tmpfs on /media type tmpfs (rw,nosuid,nodev,noexec,relatime,seclabel,mode=755)
mqueue on /dev/mqueue type mqueue (rw,relatime,seclabel)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
configfs on /sys/kernel/config type configfs (rw,relatime)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime)
sunrpc on /proc/fs/nfsd type nfsd (rw,relatime)
/dev/sda1 on /boot type ext4 (rw,relatime,seclabel,data=ordered)
gvfs-fuse-daemon on /run/user/falko/gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,relatime,user_id=500,group_id=500)
encfs on /home/falko/decrypted type fuse.encfs (rw,nosuid,nodev,relatime,user_id=500,group_id=500,default_permissions)
[falko@localhost ~]$


df -h
[falko@localhost ~]$ df -h
Filesystem                    Size  Used Avail Use% Mounted on
rootfs                         28G  6.2G   21G  23% /
devtmpfs                      493M     0  493M   0% /dev
tmpfs                         502M  240K  502M   1% /dev/shm
tmpfs                         502M  1.3M  501M   1% /run
/dev/mapper/VolGroup-lv_root   28G  6.2G   21G  23% /
tmpfs                         502M     0  502M   0% /sys/fs/cgroup
tmpfs                         502M     0  502M   0% /media
/dev/sda1                     485M   87M  373M  19% /boot
encfs                          28G  6.2G   21G  23% /home/falko/decrypted
[falko@localhost ~]$

To save your data in encrypted form, put your data into the decrypted directory, just as you would do with a normal directory:

cd ~/decrypted
echo "hello foo" > foo
echo "hello bar" > bar
ln -s foo foo2

If you check the contents of the directory, you will see that you can see it in unencrypted form...

ls -l
[falko@localhost decrypted]$ ls -l
total 8
-rw-rw-r--. 1 falko falko 10 Dec  5 19:54 bar
-rw-rw-r--. 1 falko falko 10 Dec  5 19:54 foo
lrwxrwxrwx. 1 falko falko  3 Dec  5 19:54 foo2 -> foo
[falko@localhost decrypted]$

... while in the encrypted directory, it's encrypted:

cd ~/encrypted
ls -l
[falko@localhost encrypted]$ ls -l
total 8
lrwxrwxrwx. 1 falko falko 24 Dec  5 19:54 JW2UGj8FE455Fz,UeG8pssdd -> wRgqhN5pJJ-8howYSOvnP-Aq
-rw-rw-r--. 1 falko falko 26 Dec  5 19:54 novYngutPaPhTfBmaz-9Roi,
-rw-rw-r--. 1 falko falko 26 Dec  5 19:54 wRgqhN5pJJ-8howYSOvnP-Aq
[falko@localhost encrypted]$

To unmount the encrypted volume, run:

fusermount -u ~/decrypted

Check the outputs of...


... and...

df -h

... and you will see that the EncFS volume isn't listed anymore.

To mount it again, run

encfs ~/encrypted ~/decrypted

You will be asked for the password you defined earlier:

[falko@localhost ~]$ encfs ~/encrypted ~/decrypted
EncFS Password:
<-- yoursecretpassword
[falko@localhost ~]$

If you specify the correct password, this will mount the ~/encrypted directory to ~/decrypted from where you can access your encrypted data in unencrypted form. If you forget the password, your encrypted data is lost!

If you want to change the password, you can do this with the

encfsctl passwd ~/encrypted


[falko@localhost ~]$ encfsctl passwd ~/encrypted
Enter current Encfs password
EncFS Password:
<-- yoursecretpassword
Enter new Encfs password
New Encfs Password:
<-- newsecretpassword
Verify Encfs Password: <-- newsecretpassword
Volume Key successfully updated.
[falko@localhost ~]$


Share this page:

0 Comment(s)