A common technique used by some people is to hide the files in obscure locations, such as a deeply nested folder, where other users cannot easily find it, but that’s not entirely foolproof, as it could show up in search results. Short of removing the file from the computer completely, the next best way to prevent unauthorised access to your private files is to store them in an encrypted location. There are several ways to encrypt a folder in Ubuntu, but I will show you how to use VeraCrypt, a free, open-source and cross-platform data encryption tool.
Install VeraCrypt
To install VeraCrypt in Ubuntu, run the following commands in the terminal: Once installed, launch it from the Unity Dash or your preferred application launcher.
Create an Encrypted Volume
The first thing you need to do is create an encrypted volume where you will store all folders you’d like to protect.
Select a drive slot, and click “Create Volume.”
Select “Create an encrypted file container” and click “Next.”
Choose “Standard VeraCrypt volume.”
Next, you need to create a file for your encrypted volume. Click “Select File.”
Navigate to the directory where you want the volume to reside, enter a name for the encrypted volume and click “Save.”
In the next step choose your preferred Encryption Algorithm and Hash Algorithm. The defaults should be okay for most uses.
Next, you need to specify the size of your encrypted container. Specify a big enough size to hold all the files you’d like to store there.
Now choose a complex password for your container. This is the password that will be used to mount the container and access any files stored there.
Next, select a filesystem for your container. FAT is the safest option because it works on all operating systems.
Move your mouse randomly on the window, preferably until the bar is full. This helps to increase the cryptographic strength of the encryption keys.
Finally, click “Format” to start the volume creation process. After a while you will get a success message. You can then exit the volume creation wizard.
Mount Encrypted Volume
To mount the encrypted volume, open VeraCrypt and select the file you created in the previous step.
Click “Mount” and enter the password you used while creating the volume.
Your container will be mounted and ready to use. Double click its drive slot to open it in your file manager.
You can use your encrypted volume just like any other partition on your hard drive. Anything you keep here will be encrypted and inaccessible to other users once you dismount the partition.
Please note that an encrypted volume is just like a file and can be deleted. You are advised to make regular backups on an external drive so that you don’t lose all your files if the volume gets deleted. We’d love to hear how you protect sensitive documents on your Linux PC. Any thoughts, questions or suggestions are welcome.