LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

systemd-ask-password

Query user for system password

TLDR

Ask for a password on the terminal or through a running agent
$ systemd-ask-password "[prompt]"
copy
Echo the characters as they are typed
$ systemd-ask-password --echo "[prompt]"
copy
Reuse an answer that is already cached in the kernel keyring
$ systemd-ask-password --accept-cached --keyname [key_name] "[prompt]"
copy
Cache the answer without printing it
$ systemd-ask-password --no-output --keyname [key_name] "[prompt]"
copy
Accept several passwords in one query
$ systemd-ask-password --multiple "[prompt]"
copy
Give up after a time limit
$ systemd-ask-password --timeout [30] "[prompt]"
copy
Never prompt on the terminal, so only an agent can answer
$ systemd-ask-password --no-tty --id [myapp]/[disk] "[prompt]"
copy
Choose the icon an agent shows beside the prompt
$ systemd-ask-password --icon [drive-harddisk] "[prompt]"
copy
Feed the answer to a command without a trailing newline
$ systemd-ask-password -n | [command]
copy

SYNOPSIS

systemd-ask-password [options] [message]

DESCRIPTION

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.

PARAMETERS

--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

INSTALL

sudo apt install systemd
copy
sudo dnf install systemd
copy
sudo pacman -S systemd
copy
sudo zypper install systemd
copy
brew install systemd
copy
nix profile install nixpkgs#systemd
copy

CAVEATS

Cached passwords in the kernel keyring are cleared on reboot. The --no-tty option requires a password agent to be running. Part of the systemd suite.

SEE ALSO

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid