I installed Ubuntu 11.10 with the alternate CD and encrypted the whole system (except boot) with the encrypted LVM. Everything works great as before, but I would like to change the password of the encrypted LVM. I tried to follow the Tips and Tricks of this article, but it does not work. After typing:

sudo cryptsetup luksDump /dev/sda5

It says: "Device /dev/sd5 doesn't exist or access denied." I thought the encrypted partition is /dev/sda5. Any help how to change the password?

share|improve this question
1  
Oops, it was indeed a typo! I always typed /dev/sd5 instead of /dev/sd5. Thanks Hamish for the hint. So I answer the question with the information from Andreas Härter (blog.andreas-haerter.com/2011/06/18/ubuntu-full-disk-encryp‌​tion-lvm-luks#tips_a‌​nd_tricks) – Filbuntu Mar 5 '12 at 12:53
2  
possible duplicate of How to change LUKS passphrase? – Gilles Jul 11 '12 at 23:09
up vote 28 down vote accepted

Here is the answer that worked for me, after Hamish helped me to realize my typo:

To add a new password, use luksAddKey:

sudo cryptsetup luksAddKey /dev/sda5

To remove an existing password, use luksRemoveKey:

sudo cryptsetup luksRemoveKey /dev/sda5

Cited from this blog. Thanks.

share|improve this answer
1  
does this imply you can have more than one password to unencrypt the disk? – bph Jan 18 '16 at 16:05
    
It obviously implies it. The question is; can you have more than one? I'm taking a wild guess: Yes. – Rob Quist Jan 19 '16 at 17:57
3  
You can. I tested it out – bph Jan 25 '16 at 22:31
1  
There are slots - eight of them I believe. Each slot is an unlock option. Could be 8 passwords if you wanted. – Cookie Jul 31 '16 at 14:44

Download "Disks" from Software Manager. Run it. Select your encrypted device partition. Click gear icon. Select "Change passphrase". That's it

share|improve this answer

Without thinking I set the passphrase to be really long, and it became a pain to type. I ended up using the following to change it to something more manageable.

sudo cryptsetup luksChangeKey /dev/sda5
share|improve this answer

The encrypted partition may well be using /dev/sda5 (note the a in sda5) and that is the device you probably need to use (unless that is just a typo in your question).

However the encrypted device itself will have another name - something like /dev/mapper/cryptroot. For the device name you could:

  • look in the file /etc/crypttab - this will have both the partition and the mapper name in it, but only for permanent partitions
  • run mount and see what the mapper name is - this is useful when you have plugged in an encrypted disk via USB. (Though I'm not sure how you then find the actual underlying device name).
share|improve this answer

To see the slots used:

sudo cryptsetup luksDump /dev/sda5

And to find out which partition to use

cat /etc/crypttab

And if it is listed by uuid, use

ls -l /dev/disk/by-uuid/{insert your uuid here}

Then use

sudo cryptsetup luksAddKey /dev/sda5
sudo cryptsetup luksRemoveKey /dev/sda5

or

sudo cryptsetup luksChangeKey /dev/sda5

and for faster reference (assuming only 1 entry in /etc/crypttab)

sudo cryptsetup luksAddKey /dev/disk/by-uuid/$(cat /etc/crypttab | sed -e "s|\(.*\) UUID=\(.*\) none.*|\2|g")
sudo cryptsetup luksChangeKey /dev/disk/by-uuid/$(cat /etc/crypttab | sed -e "s|\(.*\) UUID=\(.*\) none.*|\2|g")
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.