How to Encrypt Folder in Ubuntu

Encrypting folders in Ubuntu allows you to code your data which can then not be deleted. Follow this step by step tutorial to learn how.

Don’t forget to check out our site for more free how-to videos! – our feed – join us on facebook – our group in Google+

In this tutorial, we will show you how to encrypt a folder in Ubuntu. After you encrypt folders in Ubuntu, that specific folder cannot be deleted or moved to trash. Hence, your files inside that specific folder are then safe. Mounting and encrypting folders in Ubuntu is a easy process. To learn how to do this, follow the steps given below.

Step 1 — Open the terminal application
First of all, click on the Dash and open up the terminal application.
Once the terminal opens up, we will install the eCryptfs kernel module. For that, type in
“sudo aptitude install ecryptfs-utils” and hit the “enter” key.

Step 2 — Enter password
With that done, type the password to continue with the process and later when prompted, type “y” to continue with the installation.

Step 3 — Get update
With that done, we will get an update and for that, type in
“sudo apt-get update” and hit “enter”.

Step 4 — Exist from terminal
When the installation is complete, let’s exit from the terminal and restart Ubuntu.

Step 5 — Create a directory
With the system rebooted, let’s open up the terminal application once more and from here, let’s create a new directory by typing in the mkdir ~/test command and hitting the “enter” key. This will create a directory named “test”.

Step 6 — Mount and encrypt the folder
Now let’s mount and encrypt the newly created folder. For that, type the command:
Sudo mount –t ecryptfs ~/test ~/test and press “enter”.

Step 7 — Type in the password
With that done, you will be required to type in the password in order to continue with the process.

Step 8 — Authenticate the passphrase
Now you will be required to authenticate the passphrase. As per your authentication requirements you can type in the value and hit the “enter” key. For this tutorial, we will type 1 and press “enter”.

Step 9 — Select the cipher
You will now be required to select the cipher. Over here, we will select the first option, with the block size 16.

Step 10 — Select the key bytes
Next, select the key bytes and that should be exactly same to the block size we selected earlier. Therefore, over here we will type in 1 and press “enter”.

Step 11 — Enable the plaintext passthrough
With that done, it will prompt you to enable the plaintext passthrough. Over here, let’s type “y” and hit “enter”. If you want to encrypt the file inside the encrypted folder, then type in “n” and hit “enter”.

Step 12 — Finish mounting your folder
Now you will be prompted whether you want to enable filename encryption or not. Let’s type in “n” and hit “enter”. And that’s it your folder is now Mounted with eCryptfs.
By following the steps given above you can easily understand how to encrypt a folder in Ubuntu.

Step 13 — Move folder to trash
Now let’s open up the home folder. Over here, right click on the test folder and let’s move it to trash. You can see that when you encrypt folders they cannot be moved to trash.

Step 14 — Delete the folder
Now let’s try to delete the folder as well. You can see that the folder does not get deleted. This means that you have successfully encrypted the folder.