Cryptsetup

為什麼“cryptsetup luksFormat”不提示輸入密碼?

  • April 5, 2018

我希望cryptsetup提示我輸入密碼,但它只是在嘗試打開密鑰文件但未能成功:

sudo cryptsetup luksFormat test.img cryptsetup-test

WARNING!
========
This will overwrite data on test.img irrevocably.

Are you sure? (Type uppercase yes): YES
Failed to open key file.

您混淆了luksFormatand的語法luksOpen

luksFormat不打開設備,因此不採用設備名稱來映射到。因此,如果您嘗試傳遞一個,它會將其解釋為密鑰文件的文件名並嘗試(並且可能會失敗)打開它。

這是一個例子luksFormat

sudo cryptsetup luksFormat test.img
WARNING!
========
This will overwrite data on test.img irrevocably.

Are you sure? (Type uppercase yes): YES
Enter passphrase:
Verify passphrase:

還有一個例子luksOpen

sudo cryptsetup luksOpen test.img cryptsetup-test
Enter passphrase for test.img

引用自:https://unix.stackexchange.com/questions/435731