我的 LUKS 加密驱动器有 3 个密码短语。其中两个是安全的(并且很长),另一个丢失了。然而,我依稀记得它达不到标准;它在实验期间使用过,之后应该擦掉。鉴于我不再知道它,但至少其他两个,我怎么能摆脱它?
Wer*_*eii 12
我无法发表评论,但可以扩展@PerlDucks 的答案
cryptsetup open您可以使用(或cryptsetup luksOpen- 旧语法)和--test-passphraseflag,而不必打开/锁定要测试的每个键的分区,someAlias然后可以省略。
例子:cryptsetup -v open --test-passphrase --type luks /dev/sdb4
片段来自man cryptsetup
...
--test-passphrase
Do not activate the device, just verify passphrase. This option is only relevant for
open action (the device mapping name is not mandatory if this option is used).
...
Run Code Online (Sandbox Code Playgroud)
根据cryptsetup 变更日志,此标志自 起可用2012-06-18,或自 cryptsetup 版本起1.5.0-rc2可用(这意味着,今天几乎每个人都可以使用它)
Per*_*uck 11
神奇的选择是 luksKillSlot。
关键是要弄清楚您的三个键槽中的哪一个包含要删除的键。如果你还不知道,你可以通过一个接一个地尝试所有已知的键来检查这一点,然后让cryptsetup告诉你哪个键指的是哪个槽。未知键然后指的是剩余的槽。
检查使用了哪些插槽(在我的情况下使用了插槽 0、1 和 2)。替换/dev/sdb4
为您的实际设备:
root@host:~# cryptsetup luksDump /dev/sdb4
LUKS header information for /dev/sdb4
...
Key Slot 0: ENABLED
...
Key Slot 1: ENABLED
...
Key Slot 2: ENABLED
...
Key Slot 3: DISABLED
Key Slot 4: DISABLED
Key Slot 5: DISABLED
Key Slot 6: DISABLED
Key Slot 7: DISABLED
Run Code Online (Sandbox Code Playgroud)
现在使用您的第一个密钥打开(=解密)您的设备,并cryptsetup详细说明使用哪个插槽来解锁设备:
root@host:~# cryptsetup -v open --type luks /dev/sdb4 someAlias
[enter one of your two known keys]
Key slot 2 unlocked.
Command successful.
Run Code Online (Sandbox Code Playgroud)
记住第一个键所指的是哪个插槽(在本例中为 2)并撤消该步骤:
root@host:~# cryptsetup close someAlias
Run Code Online (Sandbox Code Playgroud)
重复您的第二个已知密钥:
root@host:~# cryptsetup -v open --type luks /dev/sdb4 someAlias
[enter the second of your two known keys]
Key slot 0 unlocked.
Command successful.
root@host:~# cryptsetup close someAlias
Run Code Online (Sandbox Code Playgroud)
现在您知道这两个已知密钥指的是槽 2 和槽 0。因此槽 1 必须是包含未知密钥的那个。删除它:
root@host:~# cryptsetup -v luksKillSlot /dev/sdb4 1
Keyslot 1 is selected for deletion.
Enter any remaining passphrase:
[enter one of the two known keys]
Key slot 0 unlocked.
Command successful.
Run Code Online (Sandbox Code Playgroud)
一探究竟:
root@host:~# cryptsetup luksDump /dev/sdb4
LUKS header information for /dev/sdb4
...
Key Slot 0: ENABLED
...
Key Slot 1: DISABLED
Key Slot 2: ENABLED
...
Key Slot 3: DISABLED
Key Slot 4: DISABLED
Key Slot 5: DISABLED
Key Slot 6: DISABLED
Key Slot 7: DISABLED
Run Code Online (Sandbox Code Playgroud)