我已经使用cryptsetup来encryption外部硬盘驱动器。
以这种方式使用encryption的硬盘时,我没有问题:
/sbin/cryptsetup luksOpen /dev/sdc1 backup // typing password // mounting the partition // doing something // unmounting the partition /sbin/cryptsetup luksClose /dev/mapper/backup
但我的下一个要求是能够做到这一点,而不需要input密码。
然后我通过这个命令创build了一个二进制文件,其中包含密码的哈希值:
hashalot -n 32 ripemd160 > volume_key
接着:
/sbin/cryptsetup luksOpen -d volume_key /dev/sdc1 backup
但我得到这个错误:
Command failed: No key available with this passphrase.
任何想法家伙?
如果你像我一样寻找答案,就像这样:
然后我通过这个命令创build了一个二进制文件,其中包含密码的哈希值:
hashalot -n 32 ripemd160 > volume_key
然后你必须:
/sbin/crypsetup luksAddKey volume_key Enter any passphrase: <- enter current passphrase aka: "typing password"
现在cryptsetup已经添加了你的文件(volume_key)作为你的卷的另一个关键。 从技术上讲,你可以使用任何你想要的文件作为这个键。 一个JPG图像,甚至任何文件充满随机文本。
最后,现在你可以
/sbin/cryptsetup luksOpen -d volume_key /dev/sdc1 backup
cryptsetup将使用密钥文件,如果它在那里,或者如果它找不到文件请求您的密码。
cryptsetup手册页build议关于-d参数的以下内容: “如果要通过密钥文件设置新密钥,则必须使用位置arg到luksFormat或luksAddKey。
volume_key文件的内容将被cryptsetup哈希,所以你不需要自己做?