Bitcoin donations are welcome:14snQXeLcnJtWUduKZ6rC2MHdPYrYar1Tw

Friday, March 8, 2013

Add / Remove / Replace dm crypt passwords (debian)

General information
You can have multiple passwords to your dm crypted drive. The passwords are stored in slots. If you haven't added any passwords since you set up your system, your password is (most likely) stored in slot 0.

If you want to replace your current password, you can add a new password, taking slot 1. After doing this, you can delete slot 0.

How to..
1.) First you have to find out which device is encrypted

system:/home/user# cat /etc/crypttab
 # sda3_crypt /dev/sda3 none luks
sda3_crypt UUID=aa781a6a-7477-44a2-97c2-6c55598f4c5c none luks

As you might understand your encrypted drive is /dev/sda3.

2.) Next it's plain forward. Just remember to make sure you are using the same keymap as your are using during the initrd (bootup) process. Otherwise you might end up with a password you don't know how to type with your current keymap in initrd. Check my post about keymaps if you want to know how to change keymaps before entering new passwords.

You can add passwords by typing:

system:/home/user# cryptsetup luksAddKey /dev/sda3
Enter any LUKS passphrase:
key slot 0 unlocked.
Enter new passphrase for key slot:

You can delete slots (passwords) by typing (example will delete slot 0):

system:/home/user# cryptsetup luksDelKey /dev/sda3 0

No comments:

Post a Comment