VeraCrypt is a cross-platform encryption tool that works on Linux, macOS, and Windows. It allows you to encrypt files, create secure containers, and encrypt entire drives. This guide walks you through installing, creating, mounting, and using VeraCrypt on Linux.
Install VeraCrypt on Linux
Using APT (Debian/Ubuntu)
sudo add-apt-repository ppa:unit193/encryption
sudo apt update
sudo apt install veracrypt
Using DNF (Fedora)
sudo dnf install veracrypt
Using Pacman (Arch Linux/Manjaro)
sudo pacman -S veracrypt
Using Flatpak (Universal Method)
flatpak install flathub com.veracrypt.VeraCrypt
To run it via Flatpak:
flatpak run com.veracrypt.VeraCrypt
Create a New Encrypted Volume
Using GUI
- Open VeraCrypt from your applications menu.
- Click "Create Volume" and select:
- Create an encrypted file container (recommended for storing files)
- Encrypt a non-system partition (for encrypting a USB drive or external disk)
- Choose encryption settings (AES, SHA-512 by default).
- Set a strong password and format the volume.
Using CLI (Command Line Interface)
-
Create a 2GB encrypted file container:
veracrypt -t -c
Follow the prompts to set encryption, hash, and password.
-
Format the container:
mkfs.ext4 /path/to/container
Mount and Access Encrypted Volumes
Using GUI
- Select an available slot in VeraCrypt.
- Click "Select File" or "Select Device".
- Enter your password and click "Mount".
- The volume appears under
/media/veracryptX
.
Using CLI (Command Line Interface)
- Mount a VeraCrypt volume:
sudo veracrypt /path/to/container /mnt/veracrypt
- Unmount the volume:
sudo veracrypt -d /mnt/veracrypt
Encrypt a USB Drive or External Disk
Using GUI
- Click "Create Volume" → "Encrypt a non-system partition".
- Select the USB drive or external disk.
- Choose encryption settings, format, and set password.
Using CLI (Command Line Interface)
- Encrypt the USB drive (Warning: This will erase data!):
sudo veracrypt -t -c /dev/sdX
- Mount the encrypted USB:
sudo veracrypt /dev/sdX /mnt/usb
Automating VeraCrypt Mounting on Boot
To auto-mount a VeraCrypt volume on boot:
- Add this line to
/etc/fstab
:/path/to/container /mnt/veracrypt vfat defaults 0 2
- Use a script:
echo "your_password" | sudo veracrypt --text --password=- /path/to/container /mnt/veracrypt
Conclusion
VeraCrypt is a powerful, easy-to-use encryption tool for Linux. Whether you're encrypting folders, USB drives, or entire partitions, VeraCrypt ensures your data stays secure and private.