How to password protect a folder or directory on Linux

Suppose you have a folder in your Linux home directory, where you store secure document files which you do not want anyone to access without a password. That way, even if someone manages to get a hold of your computer and access your home directory, there is still another line of defense for your private files.

Cryptkeeper is a Linux system tray applet that manages encrypted folders. Underneath it, EncFS, which is a FUSE-based encrypted file system, handles transparent encryption/decryption.

In this tutorial, I will describe how to password protect a folder on Linux by using Cryptkeeper.

Install Cryptkeeper in Fedora

You can install Cryptkeeper from Fedora's base repository:

$ sudo yum install cryptkeeper

After installation, go to "Applications" –> "System Tools" –> "Cryptkeeper" to launch Cryptkeeper.

Cryptkeeper indicator will show up in the desktop panel on the top right corner. Click on the indicator, and choose "New encrypted folder" to create a new encrypted folder.

Choose the name of a folder to password protect, and its location.

Enter a password for your new encrypted folder. Once you click on "Forward" button, it will create a new encrypted folder.

To access an encrypted folder, you need to open it first. To open an existing encrypted folder, click on Cryptkeeper indicator, and click on the folder name. You will be prompted to enter a password. Once the folder is open, you can freely access content in it. To password protect the folder again, simply close the folder by clicking on the folder name in Cryptkeeper indicator.

If you want to set up Cryptkeeper indicator to launch automatically on your desktop, choose "Session and Startup" menu under "Settings".

Add Cryptkeeper under "Application Autostart" tab.

Install Cryptkeeper in Ubuntu, Debian or Linux Mint

To install Cryptkeeper on Debian-based Linux, use apt-get command.

$ sudo apt-get install cryptkeeper

On Ubuntu, you can launch Cryptkeeper via Unity Dash. On Debian or Linux Mint, go to "Applications" –> "System Tools" –> "Cryptkeeper" to launch Cryptkeeper.

NOTE: On recent versions of Ubuntu desktop (e.g., 12.04, 12.10 and 13.04), Cryptkeeper indicator does not show up in the Unity's top panel notification area , due to the systray's new whitelist elimination policy. To fix this problem, first obtain "systray-whitelist" value, and append 'Cryptkeeper' to the existing whitelist, as follows.

$ gsettings get com.canonical.Unity.Panel systray-whitelist
['JavaEmbeddedFrame', 'Wine', 'Update-notifier']
$ gsettings set com.canonical.Unity.Panel systray-whitelist "['JavaEmbeddedFrame', 'Wine', 'Update-notifier', 'Cryptkeeper']"

If you want Cryptkeeper indicator to show up permanently in your Ubuntu desktop, launch "Startup Applications" menu via Dash, and add Cryptkeeper as a startup program.

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.

The following two tabs change content below.
Dan Nanni is the founder and also a regular contributor of Xmodulo.com. He is a Linux/FOSS enthusiast who loves to get his hands dirty with his Linux box. He likes to procrastinate when he is supposed to be busy and productive. When he is otherwise free, he likes to watch movies and shop for the coolest gadgets.

8 thoughts on “How to password protect a folder or directory on Linux

  1. It's nice to have encrypted data and folders. But how to cope if I forget my password. It starts with a little uphill. I still think you should have a copy of the data in the cloud.

Leave a comment

Your email address will not be published. Required fields are marked *

Current ye@r *