HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

systemd-ask-password — Query the user for a system password. More information: <https://www.freedesktop.org/software/system

Submitted by: @import:tldr-pages··
0
Viewed 0 times
thecommandsystemd-ask-passwordcliqueryuserforsystem
linux

Problem

How to use the systemd-ask-password command: Query the user for a system password. More information: <https://www.freedesktop.org/software/systemd/man/latest/systemd-ask-password.html>.

Solution

systemd-ask-password — Query the user for a system password. More information: <https://www.freedesktop.org/software/systemd/man/latest/systemd-ask-password.html>.

Query a system password with a specific prompt:
systemd-ask-password "{{prompt}}"


Specify an identifier for the password query:
systemd-ask-password --id {{identifier}} "{{prompt}}"


Use a kernel keyring key name as a cache for the password:
systemd-ask-password --keyname {{key_name}} "{{prompt}}"


Set a custom timeout for the password query:
systemd-ask-password --timeout {{seconds}} "{{prompt}}"


Force the use of an agent system and never ask on current TTY:
systemd-ask-password --no-tty "{{prompt}}"


Store a password in the kernel keyring without displaying it:
systemd-ask-password --no-output --keyname {{key_name}} "{{prompt}}"


Pipe a password to a command, stripping the trailing newline:
systemd-ask-password -n | {{command}}


Display help:
systemd-ask-password {{[-h|--help]}}

Code Snippets

Query a system password with a specific prompt

systemd-ask-password "{{prompt}}"

Specify an identifier for the password query

systemd-ask-password --id {{identifier}} "{{prompt}}"

Use a kernel keyring key name as a cache for the password

systemd-ask-password --keyname {{key_name}} "{{prompt}}"

Set a custom timeout for the password query

systemd-ask-password --timeout {{seconds}} "{{prompt}}"

Force the use of an agent system and never ask on current TTY

systemd-ask-password --no-tty "{{prompt}}"

Context

tldr-pages: linux/systemd-ask-password

Revisions (0)

No revisions yet.