1SYSTEMD-ASK-PASSWORD(1) systemd-ask-password SYSTEMD-ASK-PASSWORD(1)
2
3
4
6 systemd-ask-password - Query the user for a system password
7
9 systemd-ask-password [OPTIONS...] [MESSAGE]
10
12 systemd-ask-password may be used to query a system password or
13 passphrase from the user, using a question message specified on the
14 command line. When run from a TTY it will query a password on the TTY
15 and print it to standard output. When run with no TTY or with --no-tty
16 it will use the system-wide query mechanism, which allows active users
17 to respond via several agents, listed below.
18
19 The purpose of this tool is to query system-wide passwords — that is
20 passwords not attached to a specific user account. Examples include:
21 unlocking encrypted hard disks when they are plugged in or at boot,
22 entering an SSL certificate passphrase for web and VPN servers.
23
24 Existing agents are:
25
26 • A boot-time password agent asking the user for passwords using
27 plymouth(8),
28
29 • A boot-time password agent querying the user directly on the
30 console — systemd-ask-password-console.service(8),
31
32 • An agent requesting password input via a wall(1) message — systemd-
33 ask-password-wall.service(8),
34
35 • A TTY agent that is temporarily spawned during systemctl(1)
36 invocations,
37
38 • A command line agent which can be started temporarily to process
39 queued password requests — systemd-tty-ask-password-agent --query.
40
41 Answering system-wide password queries is a privileged operation, hence
42 all the agents listed above (except for the last one), run as
43 privileged system services. The last one also needs elevated
44 privileges, so should be run through sudo(8) or similar.
45
46 Additional password agents may be implemented according to the systemd
47 Password Agent Specification[1].
48
49 If a password is queried on a TTY, the user may press TAB to hide the
50 asterisks normally shown for each character typed. Pressing Backspace
51 as first key achieves the same effect.
52
54 The following options are understood:
55
56 --icon=
57 Specify an icon name alongside the password query, which may be
58 used in all agents supporting graphical display. The icon name
59 should follow the XDG Icon Naming Specification[2].
60
61 --id=
62 Specify an identifier for this password query. This identifier is
63 freely choosable and allows recognition of queries by involved
64 agents. It should include the subsystem doing the query and the
65 specific object the query is done for. Example:
66 "--id=cryptsetup:/dev/sda5".
67
68 --keyname=
69 Configure a kernel keyring key name to use as cache for the
70 password. If set, then the tool will try to push any collected
71 passwords into the kernel keyring of the root user, as a key of the
72 specified name. If combined with --accept-cached, it will also try
73 to retrieve such cached passwords from the key in the kernel
74 keyring instead of querying the user right away. By using this
75 option, the kernel keyring may be used as effective cache to avoid
76 repeatedly asking users for passwords, if there are multiple
77 objects that may be unlocked with the same password. The cached key
78 will have a timeout of 2.5min set, after which it will be purged
79 from the kernel keyring. Note that it is possible to cache multiple
80 passwords under the same keyname, in which case they will be stored
81 as NUL-separated list of passwords. Use keyctl(1) to access the
82 cached key via the kernel keyring directly. Example:
83 "--keyname=cryptsetup"
84
85 --credential=
86 Configure a credential to read the password from – if it exists.
87 This may be used in conjunction with the LoadCredential= and
88 SetCredential= settings in unit files. See systemd.exec(5) for
89 details. If not specified, defaults to "password". This option has
90 no effect if no credentials directory is passed to the program
91 (i.e. $CREDENTIALS_DIRECTORY is not set) or if the no credential
92 of the specified name exists.
93
94 --timeout=
95 Specify the query timeout in seconds. Defaults to 90s. A timeout of
96 0 waits indefinitely.
97
98 --echo=yes|no|masked
99 Controls whether to echo user input. Takes a boolean or the special
100 string "masked", the default being the latter. If enabled the typed
101 characters are echoed literally, which is useful for prompting for
102 usernames and other non-protected data. If disabled the typed
103 characters are not echoed in any form, the user will not get
104 feedback on their input. If set to "masked", an asterisk ("*") is
105 echoed for each character typed. In this mode, if the user hits the
106 tabulator key ("↹"), echo is turned off. (Alternatively, if the
107 user hits the backspace key ("⌫") while no data has been entered
108 otherwise, echo is turned off, too).
109
110 --echo, -e
111 Equivalent to --echo=yes, see above.
112
113 --emoji=yes|no|auto
114 Controls whether or not to prefix the query with a lock and key
115 emoji (🔐), if the TTY settings permit this. The default is "auto",
116 which defaults to "yes", unless --echo=yes is given.
117
118 --no-tty
119 Never ask for password on current TTY even if one is available.
120 Always use agent system.
121
122 --accept-cached
123 If passed, accept cached passwords, i.e. passwords previously
124 entered.
125
126 --multiple
127 When used in conjunction with --accept-cached accept multiple
128 passwords. This will output one password per line.
129
130 --no-output
131 Do not print passwords to standard output. This is useful if you
132 want to store a password in kernel keyring with --keyname= but do
133 not want it to show up on screen or in logs.
134
135 -n
136 By default, when writing the acquired password to standard output
137 it is suffixed by a newline character. This may be turned off with
138 the -n switch, similar to the switch of the same name of the
139 echo(1) command.
140
141 -h, --help
142 Print a short help text and exit.
143
145 On success, 0 is returned, a non-zero failure code otherwise.
146
148 systemd(1), systemd-ask-password-console.service(8), systemd-tty-ask-
149 password-agent(1), keyctl(1), plymouth(8), wall(1)
150
152 1. systemd Password Agent Specification
153 https://systemd.io/PASSWORD_AGENTS/
154
155 2. XDG Icon Naming Specification
156 http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
157
158
159
160systemd 251 SYSTEMD-ASK-PASSWORD(1)