3

I have lost my encryption passphrase, however my computer is still on and I would like to know if there's a way to see my passphrase to avoid having to backup my data and reinstall. The hard drive was encrypted by Ubuntu's installer.

1

1 Answer 1

0

Here's how to add a new key, if the device is still open / "decrypted". Basically, if the device is /dev/sdb2 and it's mapped name is map_name:

cryptsetup luksAddKey /dev/sdb2 --master-key-file <(dmsetup table --showkeys map_name | awk '{ print $5 }' | xxd -r -p)

It takes the master key currently used & provided by dmsetup, separates the key with awk (cut would work too), reverses the hexdump, and adds a new key with it. Like cryptsetup's man page says about the --master-key-file option: "For luksAddKey this allows adding a new passphrase without having to know an exiting one."

FYI, the xxd command is in the vim-common package on Debian / Ubuntu, there's an xxd package but it's not available for oldstable & older Ubuntus.

From the linked Q on unix & linux (thanks davidgo).

You must log in to answer this question.

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