84

Having installed Ubuntu 11.10 with whole disk encryption and LVM, I need to provide a way for users to easily change LUKS passphrase.

Preferably, this should be done using GUI tools, thus, enabling novice users to perform this basic task.

0

4 Answers 4

70

I am not familiar with GUI tool but cryptsetup is the tool to interact with LUKS.

Basically AFAIK LUKS lets you add 8 passphrase slots and you can do that with:

sudo cryptsetup -y luksAddKey ENCRYPTED_PARTITION
sudo cryptsetup luksRemoveKey ENCRYPTED_PARTITION

where 0 is the slot number. I guess LUKS stores slots as 0,1,2 etc. But I recommend you to be very careful with LUKS as you may lock yourself out. Please refer to manual of cryptsetup. Also I recommend you to visit other distro IRC channel just to be extra safe before you proceed.

You may need to reboot the machine and try your new passsphrase as well before you remove the key.

cryptsetup FAQ

Edit: Seems like gnome-disks (AKA gnome-disk-utility) lets you change the passphrase.

enter image description here

enter image description here

4
  • cryptsetup luksRemoveKey <partition> actually takes a keyfile as the last parameter. So if you want to input the passphrase, just give the device as parameter. cryptsetup will first prompt for "Enter LUKS passphrase to be deleted:" and then "Enter any remaining LUKS passphrase:" Apr 17, 2013 at 9:30
  • Avoid the gnome utility if your passphrase is very long, it may cut your input...
    – Thomas
    May 30, 2015 at 20:51
  • @Thomas or whoever else is interested: at least 14 characters are not too long for the gnome disk utility.
    – KlaymenDK
    Apr 13, 2016 at 13:52
  • 1
    I just tried the gnome utility with an old password 22 characters long and a new passphrase 9 words long, and it failed enough times that I assume I typed it right at least once, and it's being truncated. Aug 13, 2018 at 21:42
54

Tested in Ubuntu 14.04: Search for the "Disks" application

Select Device, select volume, Click cogs (more actions) -> "Change passphrase"

screenshot screenshot

5
  • Doesn't work with "long" passphrases...
    – Thomas
    May 30, 2015 at 20:47
  • What actual application is this please? apt-get install ???
    – shadowbq
    Oct 9, 2015 at 13:16
  • FYI: gnome-disk-utility / apt-get install gnome-disk-utility && gnome-disks
    – shadowbq
    Oct 9, 2015 at 13:23
  • 2
    This is the built-in Disks application. No need to install anything. It works with fairly decent passwords. I haven't tried anything over 20 characters though. Nov 26, 2015 at 2:55
  • 1
    After I did this, for some reason Ubuntu's system keyboard layout changed from Dvorak to Qwerty. It tooks me quite a while to figure out. It was a slow process as you cannot see which keyboard layout you are using (bug #1862656) and you cannot choose to display the password (bug #1862654). Also, you only get three tries (bug #1862660).
    – Flimm
    Feb 10, 2020 at 16:21
31
cryptsetup luksChangeKey <target device> -S <target key slot number>

This will ask you first for a valid pass-phrase (in any enabled keyslot) then will prompt you fro the new passphrase in the target keyslot.

From man page:

--key-slot, -S <0-7> For LUKS operations that add key material, this options allows you to specify which key slot is selected for the new key. This option can be used for luksFormat, and luksAddKey. In addition, for open, this option selects a specific key-slot to compare the passphrase against. If the given passphrase would only match a different key-slot, the operation fails.

2
  • 1
    In 12.04.5 I was asked for the new password twice.
    – Devin Lane
    Sep 19, 2015 at 21:00
  • Better answer, even if this is without gui
    – Alessio
    May 11, 2019 at 13:31
4

Tested on Ubuntu 18.04 run gnome-disks and you can point and click to change the passphrase for the encryption. In the same manner as the accepted answer above.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .