3
1
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.
3
1
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.
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).
2
You can't see the passphrase, but apparently you can change it - https://unix.stackexchange.com/questions/161915/change-password-on-a-luks-filesystem-without-knowing-the-password#161920
– davidgo – 2017-12-17T20:29:57.840