How To Encrypt Directories with eCryptfs in Ubuntu

eCryptfs is a free and open source enterprise cryptographic filesystem disk encryption software for Linux. Using eCryptfs, you can encrypt directory to store the confidential data and mount it on any directory. It supports local filesystem and networked filesystems. It is based on Cryptfs and the FiST framework for stacked filesystems.

How to install eCryptfs on Ubuntu

eCryptfs is available from the default Ubuntu repository. Run below command in the terminal app (ctrl+alt+t) to install the latest version of eCryptfs on your system.

sudo apt install ecryptfs-utils -y

Encrypt Directories With eCryptfs

Create a empty directory in your Home directory. For me its “mani“.


To encrypt the directory mani with ecryptfs, run the below command.

sudo mount -t ecryptfs ~/mani/ ~/mani/

In the “Select key type to use for newly created files” section

Type 2 and press the enter key.
Now type any password and press enter.

Also Read:  Rxvt Unicode Terminal Emulator

eCryptfs 1

Now choose any cipher and press the enter key. For me its “1”

eCryptfs 2

Then Select key bytes (2 for me ) and press the enter key.

eCryptfs 3

Now in enable plaintext passthrough (y/n) [n] option type “n” and press enter.
Enable filename encryption (y/n) [n]: n and press enter.

eCryptfs 4

Would you like to proceed with the mount (yes/no)? :yes

and in order to avoid this warning in the future (yes/no)? : yes

eCryptfs 5

The “mani” directory has been encrypted now and mounted.

eCryptfs 6

You can read and write data saved inside this directory as long as the directory is mounted. Once the directory is unmounted, you can view what is saved in the directory, but can’t read them.

You can unmount using below command.

sudo umount ~/mani


If you liked this article, please subscribe to our YouTube Channel. You can also stay connected with us on X (Twitter) and Facebook.

Leave a Reply