How to Encrypt Files and Folders with VeraCrypt in Ubuntu

It may be a good idea sometimes to keep certain files and folders in an encrypted location to prevent unauthorised access. This is especially important on a shared computer where you might have some sensitive documents that you don’t want other users to see.

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:

sudo add-apt-repository ppa:unit193/encryption
sudo apt update
sudo apt install veracrypt

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.

1. Select a drive slot, and click “Create Volume.”


2. Select “Create an encrypted file container” and click “Next.”

VeraCrypt Volume Creation Wizard_043

3. Choose “Standard VeraCrypt volume.”

VeraCrypt Volume Creation Wizard_044

4. Next, you need to create a file for your encrypted volume. Click “Select File.”

VeraCrypt Volume Creation Wizard_045

5. Navigate to the directory where you want the volume to reside, enter a name for the encrypted volume and click “Save.”

Specify a New VeraCrypt Volume_055

6. In the next step choose your preferred Encryption Algorithm and Hash Algorithm. The defaults should be okay for most uses.

VeraCrypt Volume Creation Wizard_048

7. 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.

VeraCrypt Volume Creation Wizard_049

8. 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.

VeraCrypt Volume Creation Wizard_050

9. Next, select a filesystem for your container. FAT is the safest option because it works on all operating systems.

VeraCrypt Volume Creation Wizard_051

10. Move your mouse randomly on the window, preferably until the bar is full. This helps to increase the cryptographic strength of the encryption keys.

VeraCrypt Volume Creation Wizard_052

11. 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.


Select a VeraCrypt Volume_053

Click “Mount” and enter the password you used while creating the volume.

Enter password for "-home-ayo-Documents-test-encrypted"_054

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.

Ayo Isaiah
Ayo Isaiah

Ayo Isaiah is a freelance writer from Lagos who loves everything technology with a particular interest in open-source software. Follow him on Twitter.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox