Create a Private Encrypted Folder On Ubuntu Hardy With eCryptfs

eCryptfs is a encryption application for Linux that you can use to encrypt your files/folders and prevent others from viewing it. eCryptfs does not require its own partition. You can easily create a dynamic encrypted private directory on your Home folder that will shrink or grow in size according to the files you add to it. Whatever files you place in the private directory will be encrypted and safe from the public eyes.

In Ubuntu Ibex, the eCryptfs package was included in the Ubuntu main to support the use of a secret encrypted folder in the Home folder. To get it working in Ubuntu Hardy, you will have to follow the steps below:

First, install the eCryptfs package:

sudo apt-get install ecryptfs-utils

Create your own secret folder.

mkdir /secret

Mount the ecryptfs to the secret folder

sudo mount -t ecryptfs ~/secret ~/secret

It will then prompt you to answer a few questions.

1) Selecting your key type for newly created files

ecryptfs-key type

Press “1″ to select passphrase

You will be asked to enter and verify your passphrase.

2) Selecting your encryption cipher

ecryptfs-cipher

The default option is shown in the [ ]. If you are not sure of what to select, simply press Enter to select the default.

3) Select key byte

ecryptfs-keybyte

4) Enable plaintext passthrough

If you want to use unecrypted file inside your secret folder, then select ‘Y’. If not, type ‘N’.

Now, open your Nautilus (Places->Home Folder). You should see a secret drive mounted in the filesystem.

Testing out your secret folder encryption

Add some files to the secret folder.

Unmount it

sudo umount ~/secret

Access the secret folder again and open any of the files that you have just added. You should not be able to open and view the file content. That’s good. All your files are now encrypted.

Creating a launcher

Having a launcher on your desktop allows you to mount the secret folder easily.

On your desktop, right click the mouse and select “Create Launcher“.

Enter the following:

Type: Application in Terminal
Name: eCryptfs (or whatever name you want)
Command: sudo mount -t ecryptfs /home/USER/secret /home/USER/secret key=passphrase,ecryptfs_cipher=aes,ecryptfs_key_bytes=16,ecryptfs_passthrough=n  (Replace the USER with your own username)

The next time you want to mount your secret folder, simply click on this launcher. It will pop up a terminal and ask you for your passphrase. Once that is verified, the secret folder will be mounted in the Home folder.

Do you like what you read here?

Receive the latest update in your inbox.

Or connect with us: