Problem
This page describes how to create an encrypted container on a #linux system using LUKS.
*This is not the same as on-the-fly encryption
Solution
The only software required for this process is cryptsetup
. It can be installed with apt
:
apt install cryptsetup
All the following commands should be run as root
- Create file
fallocate -l 25G /enc
Change the size of the file as necessary. This will determine the available drive space when mounted.
- Create LUKS container
cryptsetup luksFormat /enc
Follow the prompts in the command line - including the passphrase to unlock the container.
- Setup filesystem
cryptsetup luksOpen /enc enc
mkfs.ext4 /dev/mapper/enc
Once the container has been setup, the root user can mount it with the following commands.
- Open container
cryptsetup luksOpen /enc enc
You will be prompted for the passphrase used when creating the volume.
- Mount container
mount /dev/mapper/enc /data
Details