I’m using encfs to encrypt my data before storing it in the cloud, e.g., on Dropbox. Thereby, companies have no access to the original data. On the other hand, I should be able to access my files as easy as possible, including automatic mounting without the need to enter any password.

At first, we need a custom wrapper for the encfs binary, which we will create in /home/me/bin/encfs:

#!/bin/sh
encfs --public --extpass="cat /home/me/bin/encfs_password" $*

We need this wrapper, because it isn’t possible to provide encfs options in fstab. The public option allows every user to access the decrypted files, even if the directory was mounted by root (via fstab). Via extpass the password is read from the file /home/me/bin/encfs_password. This file should only contain the encfs password. Don’t forget to make the wrapper executable.

Finally, we add the following line to /etc/fstab:

/home/me/bin/encfs#/home/me/.encrypted /home/me/decrypted fuse rw,user,auto 0 0 

Change the paths according to your setup.

More information: http://wiki.gentoo.org/wiki/User:Feystorm#EncFS_.26_autofs.2Ffstab

Update

Actually, to provide the encrypted view for remote backup (while keeping the local files unencrypted), you can use encfs –reverse ~/unencrypted ~/encrypted-view

lusiads, April 3, 2015