HowTo: Change, Add, Remove LUKS passphrases

In the article HowTo: Configure Luks On CentsOS/RHEL I wen through setting up encryption on my /home partition. There are a few other things that are needed such as changing the passphrase, or removing it, or even adding another passphrase to be shared with another user of /home.

Changing LUKS passphrase

telint 3
umount /home
cruptsetup luksClose lv_home_encrypted
cryptsetup luksChangeKey /dev/VolGroupHome/lv_home
<verify and change your passphrase>
cryptsetup luksOpen /dev/VolGroupHome/lv_home lv_home_encrypted
mount /home

Add a new LUKS password

cryptsetup luksAddKey /dev/VolGroupHome/lv_home 
< enter any current passphrase and then add the new passphrase when asked >

Now, let's close and then open the partition to test the new passphrase

umount /home
cryptsetup luksClose lv_home_encrypted
cryptsetup luksOpen /dev/VolGroupHome/lv_home lv_home_encrypted
< enter the new passphrase>>

Remove LUKS Passphrase

umount /home
cryptsetup luksClose lv_home_encrypted
cruptsetup luksRemoveKey /dev/VolGroupHome/lv_home 
< enter the passphrase that you want to remove >

The passphrase is now removed. Verify by trying to use the passphrase when doing a luksOpen

cryptsetup luksOpen /dev/VolGroupHome/lv_home lv_home_encrypted