为什么“cryptsetup luksFormat”不提示输入密码?

mwf*_*ley 5 cryptsetup

我希望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.
Run Code Online (Sandbox Code Playgroud)

mwf*_*ley 3

luksFormat您混淆了and的语法luksOpen

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:
Run Code Online (Sandbox Code Playgroud)

一个例子luksOpen

sudo cryptsetup luksOpen test.img cryptsetup-test
Enter passphrase for test.img
Run Code Online (Sandbox Code Playgroud)