Change LUKS Password
Change the encryption passphrase on a LUKS-encrypted drive.
This guide assumes you have a drive encrypted with LUKS, such as one created following the Encrypt Drive guide.
Step 1 - Identify the Drive
Plug in and decrypt your encrypted drive. Then identify its device name:
lsblk -o NAME,FSTYPE,FSSIZE,FSAVAIL,MOUNTPOINT
Verify it's the correct drive by checking the LUKS header:
sudo cryptsetup luksDump /dev/sdX
Replace /dev/sdX with your device (e.g., /dev/sda).
Step 2 - Find the Key Slot
LUKS supports multiple key slots. Find which slot your current password uses:
sudo cryptsetup --verbose open --test-passphrase /dev/sdX
Enter your current passphrase when prompted. The output will show the key slot number (usually 0).
Step 3 - Change the Password
Change the passphrase for the identified key slot:
sudo cryptsetup luksChangeKey /dev/sdX -S 0
Replace 0 with your key slot number if different.
You will be prompted for your current passphrase, then asked to enter the new one twice.
Step 4 - Verify the New Password
Test that the new passphrase works:
sudo cryptsetup --verbose open --test-passphrase /dev/sdX
If successful, unmount and eject the drive. Your passphrase has been changed.