如何使用 cryptsetup luksFormat 命令自动回答“是”?

122*_*693 6 command-line scripting luks cryptsetup

如何以非交互方式运行 cryptsetup luksFormat

当LUKS格式化分区时,我收到消息

# cryptsetup luksFormat /dev/sdb

WARNING!
========
This will overwrite data on /dev/sdb irrevocably.

Are you sure? (Type uppercase yes): YES
Run Code Online (Sandbox Code Playgroud)

紧随其后Enter passphrase:

我怎样才能自动回答YES这个问题“你确定吗?

Tho*_*mas 9

您可以使用--batch-mode, -q选项cryptsetup跳过问题。

$ cryptsetup -q luksFormat /dev/sdb
Run Code Online (Sandbox Code Playgroud)

此选项还会禁用密码验证,因此应谨慎使用或在自动化环境中使用