How change LUKS encryption

Linux, Terminal

Changing the Passphrase:

sudo cryptsetup luksChangeKey /dev/sdX

LUKs Drives With Multiple Passphrases:

LUKS Drives can actually have multiple passphrases or key files associated with them, up to eight. To start, take a look at your drive and see how many keys it has. Chances are, you’ll only see key slot 0 occupied. That’s the first one.

sudo cryptsetup luksDump /dev/sdX | grep -i key

If you have free slots open, you can always add another passphrase to your drive. Run the following command, and a new key will be appended in the first free slot.

sudo cryptsetup luksAddKey /dev/sdX

When you’re managing multiple keys on the same drive, you’re going to need the ability to target specific ones. Once again, you can do that pretty simply with the -S flag. Just add the slot number after to pick a key to alter.

sudo cryptsetup luksChangeKey /dev/sdX -S 2

Removing a Passphrase

sudo cryptsetup luksRemoveKey /dev/sdX

In case you’d prefer to specify it yourself, you can use the KillSlot command to remove the key in a certain slot. Just include the slot number after the drive, and that’s the one that’ll be removed.

sudo cryptsetup luksKillSlot /dev/sdX 2