Background
On Fedora system setup, it is very easy to configure disk encryption.
Just set the checkbox “encrypt my drive” and it will be encrypted.
But you may want to change it, because it is too short, or you fear someone have got it.
A secure password
A password does not need to contain lots of crazy characters, even though this may increase the difficulty to crack.
But most important is to use a lot of characters.
A good password, depending on your threat model, may be over 20 characters long.
A trick is to concatenate (add together) random words. Start with 3, and after 2 weeks add more words to the line.
In the end you may have a nonsensical password, built up of 10 or more words, and you can remember it in your sleep.
It may not be very secure from the start, but better than “password” or reusing what you already use. And it will get stronger and stronger over time!
Check for LUKS1
If your installation is pretty old (or you use an old partition or external drive), on Fedora older than Fedora 30, you may still use LUKS1.
This standard is insecure, but you can upgrade to LUKS2.
Check your LUKS version:
sudo cryptsetup luksDump /dev/nvme0n1p3
Change your password
So how do you change the password that you use to decrypt your LUKS device?
Following this guide:
The password is just used to unlock the keyfile used for the encryption. You can have multiple passwords for multiple users.
Or you can add a password, and remove the old one, as easy as that!
- Boot your system
- Enter the terminal
- Use
lsblk
to see your disks
- all disks are in
/dev/
- SSDs are
/dev/sd[a-z]
- NVMEs are
/dev/nvme0n[1-x]
- your partition is a number behind that. Example
/dev/sda1
for SSDs, or/dev/nvme0n1p1
for NVMEs
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
zram0 252:0 0 8G 0 disk [SWAP]
nvme0n1 259:0 0 1,8T 0 disk
├─nvme0n1p1 259:1 0 576M 0 part /boot/efi
├─nvme0n1p2 259:2 0 24,3G 0 part /boot
└─nvme0n1p3 259:3 0 1,8T 0 part
└─luks-64ae1755-4591-455d-b723-1e46c31ffe53
Here, our partition of interest is /dev/nvme0n1p3
1. Add A New Password
sudo cryptsetup luksAddKey /dev/nvme0n1p3
You are prompted for your sudo password, one password to decrypt the LUKS drive, and then the password you wish.
WARNING: On Atomic Desktops (Silverblue, Kinoite, …) you can currently just use the QWERTY layout. Use a password that works here!
2. Test the password
sudo cryptsetup --test-passphrase -v open /dev/nvme0n1p3
You may want to reboot and test if the password works here.
3. Remove the old password
sudo cryptsetup luksRemoveKey /dev/nvme0n1p3
Just enter the password you want to delete.