Contents
How do you automatically unlock LUKS encrypted drives with a Keyfile?
HOWTO: Automatically Unlock LUKS Encrypted Drives With A Keyfile
- Step 1: Create a random keyfile. sudo dd if=/dev/urandom of=/root/keyfile bs=1024 count=4.
- Step 2: Make the keyfile read-only to root.
- Step 3: Add the keyfile to LUKS.
- Step 4: Create a mapper.
- Step 5: Mount the device in fstab.
- Step 6: Reboot or remount.
How do I add Keyfile to LUKS Cryptsetup?
Adding a key file to an existing LUKS volume:
- Prepare a key file, whether it is random data or something specific. Examples:
- Add the key file to the encrypted device with the command: cryptsetup luksAddKey DEV /PATH/TO/KEYFILE.
- If DEV needs to be auto-unlocked at boot time, /etc/crypttab must be edited.
Where is LUKS password stored?
LUKS password stored in plaintext at /root/keyfile.
What is ETC Crypttab?
The /etc/crypttab file describes encrypted block devices that are set up during system boot. Empty lines and lines starting with the “#” character are ignored. Each of the remaining lines describes one encrypted block device. Fields are delimited by white space.
How secure is LUKS?
By default in a Red Hat 8 Linux environment, LUKS uses a highly secure 512-bit AES (Advanced Encryption Standard) key. Encrypted LUKS volumes contain multiple key slots, allowing users to add backup keys or passphrases, plus use features such as key revocation and protection for bad passphrases using Argon2.
How to automatically unlock LUKS-encrypted disk in Linux?
### END /etc/grub.d/10_linux ### NOTE: Make sure the existing values in that file match the new contents added now: 2. Create the key file in the unencrypted /boot partition 3. Set permissions 4. Add the new file as unlock key to the encrypted volume Enter your old/existing passphrase here. Expected output: Key slot 0 unlocked. Command successful.
How many keyfiles can A Luks device hold?
LUKS/dm_crypt enabled devices may hold up to 10 different keyfiles/passwords. So, next to having the already setup password we’re going to add this keyfile as additional authorization method. sdX is of course your LUKS device. First you’ll be prompted to enter an (existing) password to unlock the drive.
How do I unlock my Luks hard drive?
First you’ll be prompted to enter an (existing) password to unlock the drive. If everything works well, you should get an output like this: Enter any LUKS passphrase: key slot 0 unlocked. Command successful. LUKS devices need to create a mapper that can then be referenced in the fstab. Open /etc/crypttab
How to automatically unlock multiple devices in intial ramdisk?
The problem there was how to unlock multiple devices in the intial ramdisk remotely. I suggested instead to use a keyfile for automatic unlocking. The keyfile should be stored in the normally encrypted root partition – so you still have to unlock that one.