In today’s life, there is always a need to secure your sensitive data on your computer. The best way to secure it is by encryption. Without encryption, the data can be accessed and manipulated by everyone. Encryption modified information and makes it unreadable by everyone else apart from those having the decryption key to convert it into the readable form.
In Linux, there are several ways to get your files encrypted, among them is VeraCrypt. This is an open-source tool for encrypting files, folders as well as the entire partition. this tool is easy to use and is also available for Windows and macOS systems.
By the end of this guide, you should be able to encrypt Files and Directories on Linux using VeraCrypt.
1) Download VeraCrypt on Linux
To install VeraCrypt on any Linux system, you will be required to download the installer file from the VeraCrypt Downloads page
Alternatively, you can download the Generic VeraCrypt installer using Wget as below. First, ensure you have Wget installed on your system.
##Debian/Ubuntu
sudo apt install wget
##RHEL/CentOS/Rocky Linux8/Fedora
Sudo yum install wget
##Arch Linux
sudo pacman -S wget
With Wget installed, download the VeraCrypt version 1.24 installer file. Visit the official download page to get the latest version.
wget https://launchpad.net/veracrypt/trunk/1.24-update7/+download/veracrypt-1.24-Update7-setup.tar.bz2
Then extract the downloaded file to a path “veracrypt”
sudo mkdir veracrypt
sudo tar -xf veracrypt-1.24-Update7-setup.tar.bz2 -C veracrypt/
Now you will have your setup file as below:
cd veracrypt/
View the content of the file:
$ ls
veracrypt-1.24-Update7-setup-console-x64 veracrypt-1.24-Update7-setup-gui-x64
veracrypt-1.24-Update7-setup-console-x86 veracrypt-1.24-Update7-setup-gui-x86
2) Install VeraCrypt on Linux
Now install VeraCrypt on Linux using the below terminal command: In this guide, I will use the X64 console installer
./veracrypt-*-setup-console-x64
Next, you will proceed to the installation setup as shown below by agreeing to License Terms
VeraCrypt 1.24-Update7 Setup
____________________
Installation options:
1) Install veracrypt_1.24-Update7_amd64.tar.gz
2) Extract package file veracrypt_1.24-Update7_amd64.tar.gz and place it to /tmp
To select, enter 1 or 2: 1
Before you can use, extract, or install VeraCrypt, you must accept the
terms of the VeraCrypt License.
Press Enter to display the license terms...
.............
Do you accept and agree to be bound by the license terms? (yes/no): yes
The installation will then start as below:
To uninstall VeraCrypt, please run 'veracrypt-uninstall.sh'.
Installing package...
usr/
usr/share/
usr/share/applications/
usr/share/applications/veracrypt.desktop
usr/share/pixmaps/
usr/share/pixmaps/veracrypt.xpm
usr/share/doc/
usr/share/doc/veracrypt/
usr/share/doc/veracrypt/License.txt
usr/share/doc/veracrypt/HTML/
.........
usr/bin/
usr/bin/veracrypt-uninstall.sh
usr/bin/veracrypt
Press Enter to exit...
3) Create an Encrypted Partition using VeraCrypt
Now you have successfully installed. Launch it from the App Menu as shown:

There are two ways to create an encrypted volume using VeraCrypt. These are:
- Encrypted file conatainer– this generates a virtual encrypted disk within a file.
- Encrypted volume within a partition or drive– this option encrypts a hard drive, hard drive partition or external disk.
Encrypting a partition is done in the following steps:
1. Create an encrypted volume
We will create an encrypted volume by clicking on Create Volume as shown.

Click on Create an encrypted file container and proceed.

In the next window, there are two options, create a standard volume or hidden volume. Select the volume type and proceed. For the purposes of this guide, I will select a Standard VeraCrypt volume

Then select Volume Location. Click on select device to select the partition you want to encrypt. Remember that the selected partition will be erased and formatted. Alternatively, you can create a new volume partition while here by clicking on Create Folder

In the created folder, create a file and select it and proceed as below.

Next, you are required to set the encryption algorithm. Select your desired algorithm to encrypt the partition.

Then set the size of the volume to be created. The size depends on what you want to store in the encrypted volume.

Then set a password to be used to access the encrypted partition. Without this password, you cannot access the data in the partition.

Select the file type in the menu.

Finish volume creation by clicking on Format. The volume will be formatted and created.

When this process is complete, you will be notified as shown.

2. Mount the encrypted Volume
Now that we have created a volume, we need to mount it. From the VeraCrypt window, Click on select file at the bottom of the window.

The selected file will appear as below. With the volume selected, click the Mount option at the bottom left of the page.

You will be prompted to enter the password you set earlier.

Since am using a sudo account, I will be required to enter the administrator’s password.

The partition will then be mounted as shown.

The volume has been mounted successfully. Go to the file manager and click on Other Locations. you should see the mounted volume. Now you can add data to the volume just like any other drive.

Please remember that the encrypted volume is just like any other file and can be deleted. So you are advised to take a regular backup to an external drive to avoid losing your files.
3. Dismount the Encrypted volume.
Once you have completed what you intended to do on the encrypted volume, you need to dismount it. This is achieved by opening VeraCrypt and select the volume to dismount then click on Dismount as shown

Now the next time you want to access the file, you will be required to mount it and provide the set password. This makes the file inaccessible to everyone except those who have the password. Remember if you do not dismount the volume, it will still be accessible by everyone.
Conclusion
We have come to the end of this amazing guide. We have successfully walked through how to Encrypt Files and Directories on Linux using VeraCrypt. With VeraCrypt, it is so easy to encrypt a partition. I hope you found this guide helpful.
See more:
- Encrypt Files and Directories on Linux using eCryptFS
- Secure FreeIPA Server With Let’s Encrypt SSL Certificate
- How To Install GitLab on Rocky Linux 8 With Let’s Encrypt
- Install Wekan Kanban on CentOS with Let’s Encrypt SSL