Folder encryption with EncFS

Sometimes we have private information, here I am using EncFS tool to protect my data.I am describing in a few minutes installation steps.

ibekyarov@machine:~$ sudo aptitude install encfs

We have to activate fuse module in the kernel, because EncFS use it.By adding “fuse” without quotes in /etc/modules,kernel will load this module on every boot.Here we are loading fuse`s module in the kernel.

ibekyarov@machine:~$ sudo modprobe fuse

Because of using fusermount we need add our user to fuse group.

ibekyarov@machine:~$ sudo adduser ibekyarov fuse
Adding user `ibekyarov' to group `fuse' ...
Adding user ibekyarov to group fuse

Here we create directory which will be encrypted.

ibekyarov@machine:~$ mkdir ~/encfs_encrypted

Here we create our mounting point of encrypted directory.

ibekyarov@machine:~$ mkdir ~/encfs_decrypted

Let`s encrypt our target.

ibekyarov@machine:~$ encfs ~/encfs_encrypted/ ~/encfs_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:
Verify Encfs Password:
fuse: failed to open /dev/fuse: Permission denied
fuse failed. Common problems:
- fuse kernel module not installed (modprobe fuse)
- invalid options -- see usage message

We have the following errors:

fuse: failed to open /dev/fuse: Permission denied
fuse failed. Common problems:
- fuse kernel module not installed (modprobe fuse)
- invalid options -- see usage message

The solution is:

ibekyarov@machine:~$ sudo /etc/init.d/udev restart
Stopping the hotplug events dispatcher: udevd.
Starting the hotplug events dispatcher: udevd.
ibekyarov@machine:~$ sudo /etc/init.d/fuse restart
Restarting filesystem in userspace: fuse.

Mount the encrypted directory.

ibekyarov@machine:~$ encfs ~/encfs_encrypted/ ~/encfs_decrypted/

EncFS Password:

ibekyarov@machine:~$ df -h | grep encfs
encfs 5.7G 4.3G 1.2G 79% /home/ibekyarov/encfs_decrypted
ibekyarov@machine:~$ cd /home/ibekyarov/encfs_decrypted/
ibekyarov@machine:~/encfs_decrypted$ touch test_encryption
ibekyarov@machine:~/encfs_decrypted$ cd ..

This unmount our encrypted directory from the mountpoint.

ibekyarov@machine:~$ fusermount -u /home/ibekyarov/encfs_decrypted/
ibekyarov@machine:~$ ls /home/ibekyarov/encfs_encrypted/

If we  want to  change our EncFS password.

ibekyarov@machine:~$ encfsctl passwd ~/encfs_encrypted/
Enter current Encfs password
EncFS Password:
Enter new Encfs password
New Encfs Password:
Verify Encfs Password:
Volume Key successfully updated.

Enjoy 🙂