更改LUKS密码

kik*_*ika 5 linux luks

我尝试更改我的 LUKS 密码。

\n\n

我使用的来源:\n https://www.linuxexperten.com/content/how-do-i-change-my-luks-encryption-password-and-more

\n\n

我有单独的分区 \xe2\x80\x99s 用于启动、根目录、交换和主目录。\n要确定哪些分区有 Luks:

\n\n
blkid -t TYPE=crypto_LUKS -o device\n/dev/sda5\n/dev/sda6\n/dev/sda7\n
Run Code Online (Sandbox Code Playgroud)\n\n

然后检查sda5占用了多少个槽位。

\n\n
$ sudo cryptsetup luksDump /dev/sda5 |grep Key.Slot\n\nKey Slot 0: ENABLED\nKey Slot 1: DISABLED\nKey Slot 2: DISABLED\nKey Slot 3: DISABLED\nKey Slot 4: DISABLED\nKey Slot 5: DISABLED\nKey Slot 6: DISABLED\nKey Slot 7: DISABLED\n
Run Code Online (Sandbox Code Playgroud)\n\n

显然 root 可以使用主密钥来添加新密钥:

\n\n
$ sudo dmsetup ls --target crypt\n\nswapfs  (254, 2)\nrootfs  (254, 0)\nhomefs  (254, 1)\n
Run Code Online (Sandbox Code Playgroud)\n\n

但后来我说让我检查一下其他分区 sda6 和 7,看看有多少个插槽被占用。更改密码前已两个已被占用。

\n\n
$ sudo cryptsetup luksDump /dev/sda6 |grep Key.Slot\n\nKey Slot 0: ENABLED\nKey Slot 1: ENABLED\nKey Slot 2: DISABLED\nKey Slot 3: DISABLED\nKey Slot 4: DISABLED\nKey Slot 5: DISABLED\nKey Slot 6: DISABLED\nKey Slot 7: DISABLED\n\n\n$ sudo cryptsetup luksDump /dev/sda7 |grep Key.Slot\n\nKey Slot 0: ENABLED\nKey Slot 1: ENABLED\nKey Slot 2: DISABLED\nKey Slot 3: DISABLED\nKey Slot 4: DISABLED\nKey Slot 5: DISABLED\nKey Slot 6: DISABLED\nKey Slot 7: DISABLED\n
Run Code Online (Sandbox Code Playgroud)\n\n

我知道所有三个分区都有相同的密码。\n我没有 LUKS 的任何其他密码。\n这是否意味着\xe2\x80\x9c 其他人可以访问\xe2\x80\x9d这两个分区?

\n

der*_*ert 1

启动时需要输入多少次密码?如果只有一次,则可能会使用其中一个插槽来“链接”加密:

  1. 您输入密码/短语来解锁分区 A
  2. 分区 A 有一个文件,其中包含分区 B 和 C 的随机生成的长密码(密钥)。
  3. 使用分区 A 的密码自动解锁分区 B 和 C。

您可能会在 中看到这方面的证据/etc/crypttab,其中会显示密钥文件的位置。

PS:如果有人想秘密访问您的加密数据,并且有足够的访问权限可以安装另一个密钥,他们只需获取主密钥的副本即可。这不会留下任何证据,并且无论密码如何更改都允许解密。解决这个问题的唯一方法是重新加密整个分区。(简而言之,LUKS 的工作原理是使用密码来加密主密钥。然后使用主密钥来加密分区。这就是为什么您可以更改密码而无需重新加密整个驱动器。)