← 返回命令列表

Linux command

systemd-ask-password 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Query

systemd-ask-password "[prompt]"

Specify

systemd-ask-password --id [identifier] "[prompt]"

Use

systemd-ask-password --keyname [key_name] "[prompt]"

Set

systemd-ask-password --timeout [seconds] "[prompt]"

Force

systemd-ask-password --no-tty "[prompt]"

Store

systemd-ask-password --no-output --keyname [key_name] "[prompt]"

Pipe

systemd-ask-password -n | [command]

说明

systemd-ask-password queries the user for a system password and optionally caches it in the kernel keyring. It integrates with the systemd password agent infrastructure for boot-time password prompts. The tool is commonly used for disk encryption passphrases, but can be used in any script requiring secure password input with optional caching.

参数

--id _identifier_
Unique identifier for the password query
--keyname _name_
Kernel keyring key name for caching
--timeout _seconds_
Timeout for password entry
--no-tty
Never query password on current TTY
--no-output
Don't print password to stdout
-n, --newline=no
Don't print trailing newline
--accept-cached
Accept cached password from keyring

FAQ

What is the systemd-ask-password command used for?

systemd-ask-password queries the user for a system password and optionally caches it in the kernel keyring. It integrates with the systemd password agent infrastructure for boot-time password prompts. The tool is commonly used for disk encryption passphrases, but can be used in any script requiring secure password input with optional caching.

How do I run a basic systemd-ask-password example?

Run `systemd-ask-password "[prompt]"` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --id _identifier_ do in systemd-ask-password?

Unique identifier for the password query