VeraCrypt under Windows using wsl
1. How to Install VeraCrypt on WSL
1.1. What?
VeraCrypt is software that allows you to create an encrypted virtual file system in an unencrypted disk drive. The host system sees this as a single large file, and only when VeraCrypt is started are those files decrypted and accessible.
1.2. Why?
Are you running a Windows computer where you don't have enough permissions to run VeraCrypt? Maybe you don't trust Windows to limit application access to those files once decrypted?
Whatever the reason, here's how to do it.
1.3. Installation
First, you need to check the OS and version of your WSL. You can check it easily:
cat /etc/issue Debian GNU/Linux 12 \n \l
Then go to the VeraCrypt download page and download the correct version. I'll download only the console .deb package, since I use Debian.
wget https://launchpad.net/veracrypt/trunk/1.26.24/+download/veracrypt-console-1.26.24-Debian-12-amd64.deb
And install it:
sudo dpkg -i veracrypt-console-1.26.24-Debian-12-amd64.deb
If you get a warning message telling you that the libfuse2 package is not installed, just install it, and reinstall VeraCrypt using the above command.
sudo apt install libfuse2
Now you can use the veracrypt
command interactively to mount or unmount an encrypted file system.
# mounting veracrypt --mount /fie_name.vc /mnt/your_mount_location # ummounting veracrypt -d /mnt/your_mount_location
1.4. Troubleshooting
If you are trying to mount to a target folder residing on a Windows drive, you may need to install an additional package to handle an NTFS file system.
sudo apt install ntfs-3g
After that, you should be able to mount and access even a target Windows directory.
1.5. Windows
If you prefer to access the mount location from Windows too and to give it a nice Windows drive letter, you need a few more steps.
First, make sure you mount your filesystem directly in the WSL filesystem:
sudo mkdir /mnt/crypt sudo chown your_user:your_group /mnt/crypt veracrypt --mount /mnt/c/filisystem.vc /mnt/crypt
Then you can go to Windows and mount it temporarily as a drive, using the native Windows WSL virtual network drive:
subst x: \\wsl.localhost\Debian\mnt\crypt
The subst
-ed drive will survive until the next Windows reboot. If you need a permanent solution, you'll need to map it as a network drive.