]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/homectl.xml
man: add version info
[thirdparty/systemd.git] / man / homectl.xml
CommitLineData
ea7a19e9
LP
1<?xml version='1.0'?>
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
db9ecf05 4<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
ea7a19e9
LP
5
6<refentry id="homectl" conditional='ENABLE_HOMED'
7 xmlns:xi="http://www.w3.org/2001/XInclude">
8
9 <refentryinfo>
10 <title>homectl</title>
11 <productname>systemd</productname>
12 </refentryinfo>
13
14 <refmeta>
15 <refentrytitle>homectl</refentrytitle>
16 <manvolnum>1</manvolnum>
17 </refmeta>
18
19 <refnamediv>
20 <refname>homectl</refname>
21 <refpurpose>Create, remove, change or inspect home directories</refpurpose>
22 </refnamediv>
23
24 <refsynopsisdiv>
25 <cmdsynopsis>
26 <command>homectl</command>
27 <arg choice="opt" rep="repeat">OPTIONS</arg>
28 <arg choice="req">COMMAND</arg>
29 <arg choice="opt" rep="repeat">NAME</arg>
30 </cmdsynopsis>
31 </refsynopsisdiv>
32
33 <refsect1>
34 <title>Description</title>
35
36 <para><command>homectl</command> may be used to create, remove, change or inspect a user's home
37 directory. It's primarily a command interfacing with
38 <citerefentry><refentrytitle>systemd-homed.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
39 which manages home directories of users.</para>
40
41 <para>Home directories managed by <filename>systemd-homed.service</filename> are self-contained, and thus
2a4be3c5
ZJS
42 include the user's full metadata record in the home's data storage itself, making them easy to migrate
43 between machines. In particular, a home directory describes a matching user record, and every user record
44 managed by <filename>systemd-homed.service</filename> also implies existence and encapsulation of a home
45 directory. The user account and home directory become the same concept.</para>
46
47 <para>The following backing storage mechanisms are supported:</para>
ea7a19e9
LP
48
49 <itemizedlist>
2a4be3c5
ZJS
50 <listitem><para>An individual LUKS2 encrypted loopback file for a user, stored in
51 <filename>/home/*.home</filename>. At login the file system contained in this files is mounted, after
52 the LUKS2 encrypted volume has been attached. The user's password is identical to the encryption
86b52a39 53 passphrase of the LUKS2 volume. Access to data without preceding user authentication is thus not
2a4be3c5 54 possible, even for the system administrator. This storage mechanism provides the strongest data
ea7a19e9
LP
55 security and is thus recommended.</para></listitem>
56
57 <listitem><para>Similar, but the LUKS2 encrypted file system is located on regular block device, such
5bc9ea07 58 as a USB storage stick. In this mode home directories and all data they include are nicely migratable
ea7a19e9
LP
59 between machines, simply by plugging the USB stick into different systems at different
60 times.</para></listitem>
61
62 <listitem><para>An encrypted directory using <literal>fscrypt</literal> on file systems that support it
63 (at the moment this is primarily <literal>ext4</literal>), located in
64 <filename>/home/*.homedir</filename>. This mechanism also provides encryption, but substantially
2a4be3c5 65 weaker than LUKS2, as most file system metadata is unprotected. Moreover
ea7a19e9
LP
66 it currently does not support changing user passwords once the home directory has been
67 created.</para></listitem>
68
69 <listitem><para>A <literal>btrfs</literal> subvolume for each user, also located in
70 <filename>/home/*.homedir</filename>. This provides no encryption, but good quota
71 support.</para></listitem>
72
73 <listitem><para>A regular directory for each user, also located in
74 <filename>/home/*.homedir</filename>. This provides no encryption, but is a suitable fallback
75 available on all machines, even where LUKS2, <literal>fscrypt</literal> or <literal>btrfs</literal>
76 support is not available.</para></listitem>
77
78 <listitem><para>An individual Windows file share (CIFS) for each user.</para></listitem>
79 </itemizedlist>
80
81 <para>Note that <filename>systemd-homed.service</filename> and <command>homectl</command> will not manage
82 "classic" UNIX user accounts as created with <citerefentry
83 project='man-pages'><refentrytitle>useradd</refentrytitle><manvolnum>8</manvolnum></citerefentry> or
84 similar tools. In particular, this functionality is not suitable for managing system users (i.e. users
85 with a UID below 1000) but is exclusive to regular ("human") users.</para>
86
87 <para>Note that users/home directories managed via <command>systemd-homed.service</command> do not show
88 up in <filename>/etc/passwd</filename> and similar files, they are synthesized via glibc NSS during
89 runtime. They are thus resolvable and may be enumerated via the <citerefentry
90 project='man-pages'><refentrytitle>getent</refentrytitle><manvolnum>1</manvolnum></citerefentry>
91 tool.</para>
92
93 <para>This tool interfaces directly with <filename>systemd-homed.service</filename>, and may execute
94 specific commands on the home directories it manages. Since every home directory managed that way also
95 defines a JSON user and group record these home directories may also be inspected and enumerated via
96 <citerefentry><refentrytitle>userdbctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>.</para>
97
98 <para>Home directories managed by <filename>systemd-homed.service</filename> are usually in one of two
99 states, or in a transition state between them: when <literal>active</literal> they are unlocked and
100 mounted, and thus accessible to the system and its programs; when <literal>inactive</literal> they are
2a4be3c5 101 not mounted and thus not accessible. Activation happens automatically at login of the user and usually
ea7a19e9
LP
102 can only complete after a password (or other authentication token) has been supplied. Deactivation
103 happens after the user fully logged out. A home directory remains active as long as the user is logged in
104 at least once, i.e. has at least one login session. When the user logs in a second time simultaneously
105 the home directory remains active. It is deactivated only after the last of the user's sessions
106 ends.</para>
107 </refsect1>
108
109 <refsect1>
110 <title>Options</title>
111
112 <para>The following general options are understood (further options that control the various properties
113 of user records managed by <filename>systemd-homed.service</filename> are documented further
114 down):</para>
115
116 <variablelist>
117
118 <varlistentry>
119 <term><option>--identity=</option><replaceable>FILE</replaceable></term>
120
121 <listitem><para>Read the user's JSON record from the specified file. If passed as
e9dd6984 122 <literal>-</literal> read the user record from standard input. The supplied JSON object must follow
885a4e6c 123 the structure documented in <ulink url="https://systemd.io/USER_RECORD">JSON User Records</ulink>.
e9dd6984 124 This option may be used in conjunction with the <command>create</command> and
ea7a19e9 125 <command>update</command> commands (see below), where it allows configuring the user record in JSON
ec07c3c8
AK
126 as-is, instead of setting the individual user record properties (see below).</para>
127
128 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
129 </varlistentry>
130
131 <varlistentry>
132 <term><option>--json=</option><replaceable>FORMAT</replaceable></term>
2a703778 133 <term><option>-j</option></term>
ea7a19e9
LP
134
135 <listitem><para>Controls whether to output the user record in JSON format, if the
136 <command>inspect</command> command (see below) is used. Takes one of <literal>pretty</literal>,
137 <literal>short</literal> or <literal>off</literal>. If <literal>pretty</literal> human-friendly
138 whitespace and newlines are inserted in the output to make the JSON data more readable. If
139 <literal>short</literal> all superfluous whitespace is suppressed. If <literal>off</literal> (the
140 default) the user information is not shown in JSON format but in a friendly human readable formatting
2a703778 141 instead. The <option>-j</option> option picks <literal>pretty</literal> when run interactively and
ea7a19e9
LP
142 <literal>short</literal> otherwise.</para></listitem>
143 </varlistentry>
144
145 <varlistentry>
146 <term><option>--export-format=</option><replaceable>FORMAT</replaceable></term>
147 <term><option>-E</option></term>
148 <term><option>-EE</option></term>
149
150 <listitem><para>When used with the <command>inspect</command> verb in JSON mode (see above) may be
151 used to suppress certain aspects of the JSON user record on output. Specifically, if
152 <literal>stripped</literal> format is used the binding and runtime fields of the record are
153 removed. If <literal>minimal</literal> format is used the cryptographic signature is removed too. If
154 <literal>full</literal> format is used the full JSON record is shown (this is the default). This
155 option is useful for copying an existing user record to a different system in order to create a
156 similar user there with the same settings. Specifically: <command>homectl inspect -EE | ssh
157 root@othersystem homectl create -i-</command> may be used as simple command line for replicating a
158 user on another host. <option>-E</option> is equivalent to <option>-j --export-format=stripped</option>,
159 <option>-EE</option> to <option>-j --export-format=minimal</option>. Note that when replicating user
160 accounts user records acquired in <literal>stripped</literal> mode will retain the original
2a4be3c5
ZJS
161 cryptographic signatures and thus may only be modified when the private key to update them is available
162 on the destination machine. When replicating users in <literal>minimal</literal> mode, the signature
163 is removed during the replication and thus the record will be implicitly signed with the key of the destination
ec07c3c8
AK
164 machine and may be updated there without any private key replication.</para>
165
166 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
167 </varlistentry>
168
169 <xi:include href="user-system-options.xml" xpointer="host" />
170 <xi:include href="user-system-options.xml" xpointer="machine" />
171
172 <xi:include href="standard-options.xml" xpointer="no-pager" />
173 <xi:include href="standard-options.xml" xpointer="no-legend" />
174 <xi:include href="standard-options.xml" xpointer="no-ask-password" />
175 <xi:include href="standard-options.xml" xpointer="help" />
176 <xi:include href="standard-options.xml" xpointer="version" />
177 </variablelist>
178 </refsect1>
179
180 <refsect1>
181 <title>User Record Properties</title>
182
183 <para>The following options control various properties of the user records/home directories that
184 <filename>systemd-homed.service</filename> manages. These switches may be used in conjunction with the
185 <command>create</command> and <command>update</command> commands for configuring various aspects of the
186 home directory and the user account:</para>
187
188 <variablelist>
189
190 <varlistentry>
191 <term><option>--real-name=</option><replaceable>NAME</replaceable></term>
192 <term><option>-c</option> <replaceable>NAME</replaceable></term>
193
194 <listitem><para>The real name for the user. This corresponds with the GECOS field on classic UNIX NSS
ec07c3c8
AK
195 records.</para>
196
197 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
198 </varlistentry>
199
200 <varlistentry>
201 <term><option>--realm=</option><replaceable>REALM</replaceable></term>
202
203 <listitem><para>The realm for the user. The realm associates a user with a specific organization or
d008666a 204 installation, and allows distinguishing users of the same name defined in different contexts. The
ea7a19e9
LP
205 realm can be any string that also qualifies as valid DNS domain name, and it is recommended to use
206 the organization's or installation's domain name for this purpose, but this is not enforced nor
207 required. On each system only a single user of the same name may exist, and if a user with the same
208 name and realm is seen it is assumed to refer to the same user while a user with the same name but
209 different realm is considered a different user. Note that this means that two users sharing the same
210 name but with distinct realms are not allowed on the same system. Assigning a realm to a user is
ec07c3c8
AK
211 optional.</para>
212
213 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
214 </varlistentry>
215
216 <varlistentry>
217 <term><option>--email-address=</option><replaceable>EMAIL</replaceable></term>
218
219 <listitem><para>Takes an electronic mail address to associate with the user. On log-in the
ec07c3c8
AK
220 <varname>$EMAIL</varname> environment variable is initialized from this value.</para>
221
222 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
223 </varlistentry>
224
225 <varlistentry>
226 <term><option>--location=</option><replaceable>TEXT</replaceable></term>
227
228 <listitem><para>Takes location specification for this user. This is free-form text, which might or
229 might not be usable by geo-location applications. Example: <option>--location="Berlin,
ec07c3c8
AK
230 Germany"</option> or <option>--location="Basement, Room 3a"</option></para>
231
232 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
233 </varlistentry>
234
235 <varlistentry>
236 <term><option>--icon-name=</option><replaceable>ICON</replaceable></term>
237
238 <listitem><para>Takes an icon name to associate with the user, following the scheme defined by the <ulink
239 url="https://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html">Icon Naming
ec07c3c8
AK
240 Specification</ulink>.</para>
241
242 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
243 </varlistentry>
244
245 <varlistentry>
246 <term><option>--home-dir=</option><replaceable>PATH</replaceable></term>
247 <term><option>-d</option><replaceable>PATH</replaceable></term>
248
249 <listitem><para>Takes a path to use as home directory for the user. Note that this is the directory
250 the user's home directory is mounted to while the user is logged in. This is not where the user's
251 data is actually stored, see <option>--image-path=</option> for that. If not specified defaults to
ec07c3c8
AK
252 <filename>/home/$USER</filename>.</para>
253
254 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
255 </varlistentry>
256
257 <varlistentry>
258 <term><option>--uid=</option><replaceable>UID</replaceable></term>
259
260 <listitem><para>Takes a preferred numeric UNIX UID to assign this user. If a user is to be created
261 with the specified UID and it is already taken by a different user on the local system then creation
262 of the home directory is refused. Note though, if after creating the home directory it is used on a
263 different system and the configured UID is taken by another user there, then
264 <command>systemd-homed</command> may assign the user a different UID on that system. The specified
265 UID must be outside of the system user range. It is recommended to use the 60001…60513 UID range for
e9dd6984
ZJS
266 this purpose. If not specified, the UID is automatically picked. If the home directory is found to be
267 owned by a different UID when logging in, the home directory and everything underneath it will have
268 its ownership changed automatically before login completes.</para>
ea7a19e9
LP
269
270 <para>Note that users managed by <command>systemd-homed</command> always have a matching group
271 associated with the same name as well as a GID matching the UID of the user. Thus, configuring the
ec07c3c8
AK
272 GID separately is not permitted.</para>
273
274 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
275 </varlistentry>
276
277 <varlistentry>
278 <term><option>--member-of=</option><replaceable>GROUP</replaceable></term>
279 <term><option>-G</option> <replaceable>GROUP</replaceable></term>
280
281 <listitem><para>Takes a comma-separated list of auxiliary UNIX groups this user shall belong
282 to. Example: <option>--member-of=wheel</option> to provide the user with administrator
283 privileges. Note that <command>systemd-homed</command> does not manage any groups besides a group
284 matching the user in name and numeric UID/GID. Thus any groups listed here must be registered
285 independently, for example with <citerefentry
e9dd6984
ZJS
286 project='man-pages'><refentrytitle>groupadd</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
287 Any non-existent groups are ignored. This option may be used more than once, in which case all
288 specified group lists are combined. If the user is currently a member of a group which is not listed,
ec07c3c8
AK
289 the user will be removed from the group.</para>
290
291 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
292 </varlistentry>
293
fada2c75
LP
294 <varlistentry>
295 <term><option>--capability-bounding-set=</option><replaceable>CAPABILITIES</replaceable></term>
296 <term><option>--capability-ambient-set=</option><replaceable>CAPABILITIES</replaceable></term>
297
298 <listitem><para>These options take a space separated list of process capabilities
299 (e.g. <constant>CAP_WAKE_ALARM</constant>, <constant>CAP_BLOCK_SUSPEND</constant>, …) that shall be
300 set in the capability bounding and ambient sets for all the user's sessions. See <citerefentry
301 project='man-pages'><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry>
302 for details on the capabilities concept. These options may be used more than once, in which case the
303 specified lists are combined. If the parameter begins with a <literal>~</literal> character the
ec07c3c8
AK
304 effect is inverted: the specified capability is dropped from the specific set.</para>
305
306 <xi:include href="version-info.xml" xpointer="v254"/></listitem>
fada2c75
LP
307 </varlistentry>
308
ea7a19e9
LP
309 <varlistentry>
310 <term><option>--skel=</option><replaceable>PATH</replaceable></term>
311
312 <listitem><para>Takes a file system path to a directory. Specifies the skeleton directory to
e9dd6984
ZJS
313 initialize the home directory with. All files and directories in the specified path are copied into
314 any newly create home directory. If not specified defaults to <filename>/etc/skel/</filename>.
ec07c3c8
AK
315 </para>
316
317 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
318 </varlistentry>
319
320 <varlistentry>
321 <term><option>--shell=</option><replaceable>SHELL</replaceable></term>
322
323 <listitem><para>Takes a file system path. Specifies the shell binary to execute on terminal
ec07c3c8
AK
324 logins. If not specified defaults to <filename>/bin/bash</filename>.</para>
325
326 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
327 </varlistentry>
328
329 <varlistentry>
4bbafcc3 330 <term><option>--setenv=</option><replaceable>VARIABLE</replaceable>[=<replaceable>VALUE</replaceable>]</term>
ea7a19e9 331
4bbafcc3
ZJS
332 <listitem><para>Takes an environment variable assignment to set for all user processes. May be used
333 multiple times to set multiple environment variables. When <literal>=</literal> and
334 <replaceable>VALUE</replaceable> are omitted, the value of the variable with the same name in the
335 program environment will be used.</para>
336
337 <para>Note that a number of other settings also result in environment variables to be set for the
338 user, including <option>--email=</option>, <option>--timezone=</option> and
ec07c3c8
AK
339 <option>--language=</option>.</para>
340
341 <xi:include href="version-info.xml" xpointer="v250"/></listitem>
ea7a19e9
LP
342 </varlistentry>
343
344 <varlistentry>
345 <term><option>--timezone=</option><replaceable>TIMEZONE</replaceable></term>
346
7fd897c5
ZJS
347 <listitem><para>Takes a time zone location name that sets the timezone for the specified user. When
348 the user logs in the <varname>$TZ</varname> environment variable is initialized from this
349 setting. Example: <option>--timezone=Europe/Amsterdam</option> will result in the environment
350 variable <literal>TZ=:Europe/Amsterdam</literal>. (<literal>:</literal> is used intentionally as part
351 of the timezone specification, see
21556381 352 <citerefentry project='man-pages'><refentrytitle>tzset</refentrytitle><manvolnum>3</manvolnum></citerefentry>.)
ec07c3c8
AK
353 </para>
354
355 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
356 </varlistentry>
357
358 <varlistentry>
359 <term><option>--language=</option><replaceable>LANG</replaceable></term>
360
361 <listitem><para>Takes a specifier indicating the preferred language of the user. The
362 <varname>$LANG</varname> environment variable is initialized from this value on login, and thus a
363 value suitable for this environment variable is accepted here, for example
ec07c3c8
AK
364 <option>--language=de_DE.UTF8</option>.</para>
365
366 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
367 </varlistentry>
368
369 <varlistentry>
370 <term><option>--ssh-authorized-keys=</option><replaceable>KEYS</replaceable></term>
371 <listitem><para>Either takes a SSH authorized key line to associate with the user record or a
372 <literal>@</literal> character followed by a path to a file to read one or more such lines from. SSH
373 keys configured this way are made available to SSH to permit access to this home directory and user
ec07c3c8
AK
374 record. This option may be used more than once to configure multiple SSH keys.</para>
375
376 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
377 </varlistentry>
378
379 <varlistentry>
380 <term><option>--pkcs11-token-uri=</option><replaceable>URI</replaceable></term>
381 <listitem><para>Takes an RFC 7512 PKCS#11 URI referencing a security token (e.g. YubiKey or PIV
382 smartcard) that shall be able to unlock the user account. The security token URI should reference a
383 security token with exactly one pair of X.509 certificate and private key. A random secret key is
384 then generated, encrypted with the public key of the X.509 certificate, and stored as part of the
385 user record. At login time it is decrypted with the PKCS#11 module and then used to unlock the
e9dd6984
ZJS
386 account and associated resources. See below for an example how to set up authentication with a
387 security token.</para>
4442c269
LP
388
389 <para>Instead of a valid PKCS#11 URI, the special strings <literal>list</literal> and
390 <literal>auto</literal> may be specified. If <literal>list</literal> is passed, a brief table of
391 suitable, currently plugged in PKCS#11 hardware tokens is shown, along with their URIs. If
392 <literal>auto</literal> is passed, a suitable PKCS#11 hardware token is automatically selected (this
393 operation will fail if there isn't exactly one suitable token discovered). The latter is a useful
394 shortcut for the most common case where a single PKCS#11 hardware token is plugged in.</para>
395
396 <para>Note that many hardware security tokens implement both PKCS#11/PIV and FIDO2 with the
397 <literal>hmac-secret</literal> extension (for example: the YubiKey 5 series), as supported with the
398 <option>--fido2-device=</option> option below. Both mechanisms are similarly powerful, though FIDO2
399 is the more modern technology. PKCS#11/PIV tokens have the benefit of being recognizable before
400 authentication and hence can be used for implying the user identity to use for logging in, which
401 FIDO2 does not allow. PKCS#11/PIV devices generally require initialization (i.e. storing a
402 private/public key pair on them, see example below) before they can be used; FIDO2 security tokens
ec07c3c8
AK
403 generally do not required that, and work out of the box.</para>
404
405 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
4442c269
LP
406 </varlistentry>
407
70e723c0
M
408 <varlistentry>
409 <term><option>--fido2-credential-algorithm=</option><replaceable>STRING</replaceable></term>
410 <listitem><para>Specify COSE algorithm used in credential generation. The default value is
411 <literal>es256</literal>. Supported values are <literal>es256</literal>, <literal>rs256</literal>
412 and <literal>eddsa</literal>.</para>
413
414 <para><literal>es256</literal> denotes ECDSA over NIST P-256 with SHA-256. <literal>rs256</literal>
415 denotes 2048-bit RSA with PKCS#1.5 padding and SHA-256. <literal>eddsa</literal> denotes
416 EDDSA over Curve25519 with SHA-512.</para>
417
ec07c3c8
AK
418 <para>Note that your authenticator may not support some algorithms.</para>
419
420 <xi:include href="version-info.xml" xpointer="v251"/></listitem>
70e723c0
M
421 </varlistentry>
422
4442c269
LP
423 <varlistentry>
424 <term><option>--fido2-device=</option><replaceable>PATH</replaceable></term>
425
426 <listitem><para>Takes a path to a Linux <literal>hidraw</literal> device
427 (e.g. <filename>/dev/hidraw1</filename>), referring to a FIDO2 security token implementing the
e0c60bf6
ZJS
428 <literal>hmac-secret</literal> extension that shall be able to unlock the user account. A random salt
429 value is generated on the host and passed to the FIDO2 device, which calculates a HMAC hash of the
41b6ae4d
ZJS
430 salt using an internal secret key. The result is then used as the key to unlock the user account. The
431 random salt is included in the user record, so that whenever authentication is needed it can be
432 passed to the FIDO2 token again.</para>
4442c269
LP
433
434 <para>Instead of a valid path to a FIDO2 <literal>hidraw</literal> device the special strings
435 <literal>list</literal> and <literal>auto</literal> may be specified. If <literal>list</literal> is
436 passed, a brief table of suitable discovered FIDO2 devices is shown. If <literal>auto</literal> is
437 passed, a suitable FIDO2 token is automatically selected, if exactly one is discovered. The latter is
438 a useful shortcut for the most common case where a single FIDO2 hardware token is plugged in.</para>
439
440 <para>Note that FIDO2 devices suitable for this option must implement the
441 <literal>hmac-secret</literal> extension. Most current devices (such as the YubiKey 5 series) do. If
442 the extension is not implemented the device cannot be used for unlocking home directories.</para>
21505c93
LP
443
444 <para>The FIDO2 device may be subsequently removed by setting the device path to an empty string
6d5ea0f1 445 (e.g. <command>homectl update $USER --fido2-device=""</command>).</para>
4442c269
LP
446
447 <para>Note that many hardware security tokens implement both FIDO2 and PKCS#11/PIV (and thus may be
448 used with either <option>--fido2-device=</option> or <option>--pkcs11-token-uri=</option>), for a
ec07c3c8
AK
449 discussion see above.</para>
450
451 <xi:include href="version-info.xml" xpointer="v246"/></listitem>
ea7a19e9
LP
452 </varlistentry>
453
17e7561a
LP
454 <varlistentry>
455 <term><option>--fido2-with-client-pin=</option><replaceable>BOOL</replaceable></term>
456
457 <listitem><para>When enrolling a FIDO2 security token, controls whether to require the user to enter
458 a PIN when unlocking the account (the FIDO2 <literal>clientPin</literal> feature). Defaults to
459 <literal>yes</literal>. (Note: this setting is without effect if the security token does not support
460 the <literal>clientPin</literal> feature at all, or does not allow enabling or disabling
ec07c3c8
AK
461 it.)</para>
462
463 <xi:include href="version-info.xml" xpointer="v249"/></listitem>
17e7561a
LP
464 </varlistentry>
465
466 <varlistentry>
467 <term><option>--fido2-with-user-presence=</option><replaceable>BOOL</replaceable></term>
468
469 <listitem><para>When enrolling a FIDO2 security token, controls whether to require the user to
470 verify presence (tap the token, the FIDO2 <literal>up</literal> feature) when unlocking the account.
471 Defaults to <literal>yes</literal>. (Note: this setting is without effect if the security token does not support
472 the <literal>up</literal> feature at all, or does not allow enabling or disabling it.)
ec07c3c8
AK
473 </para>
474
475 <xi:include href="version-info.xml" xpointer="v249"/></listitem>
17e7561a
LP
476 </varlistentry>
477
478 <varlistentry>
479 <term><option>--fido2-with-user-verification=</option><replaceable>BOOL</replaceable></term>
480
481 <listitem><para>When enrolling a FIDO2 security token, controls whether to require user verification
482 when unlocking the account (the FIDO2 <literal>uv</literal> feature). Defaults to
483 <literal>no</literal>. (Note: this setting is without effect if the security token does not support
ec07c3c8
AK
484 the <literal>uv</literal> feature at all, or does not allow enabling or disabling it.)</para>
485
486 <xi:include href="version-info.xml" xpointer="v249"/></listitem>
17e7561a
LP
487 </varlistentry>
488
05c8e12c
LP
489 <varlistentry>
490 <term><option>--recovery-key=</option><replaceable>BOOL</replaceable></term>
491
492 <listitem><para>Accepts a boolean argument. If enabled a recovery key is configured for the
493 account. A recovery key is a computer generated access key that may be used to regain access to an
494 account if the password has been forgotten or the authentication token lost. The key is generated and
495 shown on screen, and should be printed or otherwise transferred to a secure location. A recovery key
ec07c3c8
AK
496 may be entered instead of a regular password to unlock the account.</para>
497
498 <xi:include href="version-info.xml" xpointer="v247"/></listitem>
05c8e12c
LP
499 </varlistentry>
500
ea7a19e9
LP
501 <varlistentry>
502 <term><option>--locked=</option><replaceable>BOOLEAN</replaceable></term>
503
504 <listitem><para>Takes a boolean argument. Specifies whether this user account shall be locked. If
505 true logins into this account are prohibited, if false (the default) they are permitted (of course,
ec07c3c8
AK
506 only if authorization otherwise succeeds).</para>
507
508 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
509 </varlistentry>
510
511 <varlistentry>
512 <term><option>--not-before=</option><replaceable>TIMESTAMP</replaceable></term>
513 <term><option>--not-after=</option><replaceable>TIMESTAMP</replaceable></term>
514
515 <listitem><para>These options take a timestamp string, in the format documented in
516 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry> and
517 configures points in time before and after logins into this account are not
ec07c3c8
AK
518 permitted.</para>
519
520 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
521 </varlistentry>
522
523 <varlistentry>
524 <term><option>--rate-limit-interval=</option><replaceable>SECS</replaceable></term>
525 <term><option>--rate-limit-burst=</option><replaceable>NUMBER</replaceable></term>
526
527 <listitem><para>Configures a rate limit on authentication attempts for this user. If the user
528 attempts to authenticate more often than the specified number, on a specific system, within the
529 specified time interval authentication is refused until the time interval passes. Defaults to 10
ec07c3c8
AK
530 times per 1min.</para>
531
532 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
533 </varlistentry>
534
535 <varlistentry>
536 <term><option>--password-hint=</option><replaceable>TEXT</replaceable></term>
537
538 <listitem><para>Takes a password hint to store alongside the user record. This string is stored
539 accessible only to privileged users and the user itself and may not be queried by other users.
ec07c3c8
AK
540 Example: <option>--password-hint="My first pet's name"</option>.</para>
541
542 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
543 </varlistentry>
544
545 <varlistentry>
546 <term><option>--enforce-password-policy=</option><replaceable>BOOL</replaceable></term>
547 <term><option>-P</option></term>
548
549 <listitem><para>Takes a boolean argument. Configures whether to enforce the system's password policy
550 for this user, regarding quality and strength of selected passwords. Defaults to
551 on. <option>-P</option> is short for
ec07c3c8
AK
552 <option>---enforce-password-policy=no</option>.</para>
553
554 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
555 </varlistentry>
556
557 <varlistentry>
558 <term><option>--password-change-now=</option><replaceable>BOOL</replaceable></term>
559
560 <listitem><para>Takes a boolean argument. If true the user is asked to change their password on next
ec07c3c8
AK
561 login.</para>
562
563 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
564 </varlistentry>
565
566 <varlistentry>
567 <term><option>--password-change-min=</option><replaceable>TIME</replaceable></term>
568 <term><option>--password-change-max=</option><replaceable>TIME</replaceable></term>
569 <term><option>--password-change-warn=</option><replaceable>TIME</replaceable></term>
570 <term><option>--password-change-inactive=</option><replaceable>TIME</replaceable></term>
571
572 <listitem><para>Each of these options takes a time span specification as argument (in the syntax
573 documented in
675fa6ea 574 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>) and
e9dd6984 575 configures various aspects of the user's password expiration policy. Specifically,
ea7a19e9
LP
576 <option>--password-change-min=</option> configures how much time has to pass after changing the
577 password of the user until the password may be changed again. If the user tries to change their
578 password before this time passes the attempt is refused. <option>--password-change-max=</option>
e9dd6984
ZJS
579 configures how soon after it has been changed the password expires and needs to be changed again.
580 After this time passes logging in may only proceed after the password is changed.
581 <option>--password-change-warn=</option> specifies how much earlier than then the time configured
582 with <option>--password-change-max=</option> the user is warned at login to change their password as
583 it will expire soon. Finally <option>--password-change-inactive=</option> configures the time which
584 has to pass after the password as expired until the user is not permitted to log in or change the
585 password anymore. Note that these options only apply to password authentication, and do not apply to
586 other forms of authentication, for example PKCS#11-based security token
ec07c3c8
AK
587 authentication.</para>
588
589 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
590 </varlistentry>
591
592 <varlistentry>
593 <term><option>--disk-size=</option><replaceable>BYTES</replaceable></term>
594 <listitem><para>Either takes a size in bytes as argument (possibly using the usual K, M, G, …
078dfb06
LP
595 suffixes for 1024 base values), a percentage value, or the special strings <literal>min</literal> or
596 <literal>max</literal>, and configures the disk space to assign to the user. If a percentage value is
597 specified (i.e. the argument suffixed with <literal>%</literal>) it is taken relative to the
598 available disk space of the backing file system. If specified as <literal>min</literal> assigns the
599 minimal disk space permitted by the constraints of the backing file system and other limits, when
600 specified as <literal>max</literal> assigns the maximum disk space available. If the LUKS2 backend is
601 used this configures the size of the loopback file and file system contained therein. For the other
ea7a19e9
LP
602 storage backends configures disk quota using the filesystem's native quota logic, if available. If
603 not specified, defaults to 85% of the available disk space for the LUKS2 backend and to no quota for
ec07c3c8
AK
604 the others.</para>
605
606 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
607 </varlistentry>
608
609 <varlistentry>
610 <term><option>--access-mode=</option><replaceable>MODE</replaceable></term>
611
612 <listitem><para>Takes a UNIX file access mode written in octal. Configures the access mode of the
613 home directory itself. Note that this is only used when the directory is first created, and the user
614 may change this any time afterwards. Example:
ec07c3c8
AK
615 <option>--access-mode=0700</option></para>
616
617 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
618 </varlistentry>
619
620 <varlistentry>
621 <term><option>--umask=</option><replaceable>MASK</replaceable></term>
622
623 <listitem><para>Takes the access mode mask (in octal syntax) to apply to newly created files and
624 directories of the user ("umask"). If set this controls the initial umask set for all login sessions of
ec07c3c8
AK
625 the user, possibly overriding the system's defaults.</para>
626
627 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
628 </varlistentry>
629
630 <varlistentry>
631 <term><option>--nice=</option><replaceable>NICE</replaceable></term>
632
633 <listitem><para>Takes the numeric scheduling priority ("nice level") to apply to the processes of the user at login
ec07c3c8
AK
634 time. Takes a numeric value in the range -20 (highest priority) to 19 (lowest priority).</para>
635
636 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
637 </varlistentry>
638
639 <varlistentry>
640 <term><option>--rlimit=</option><replaceable>LIMIT</replaceable>=<replaceable>VALUE</replaceable><optional>:<replaceable>VALUE</replaceable></optional></term>
641
642 <listitem><para>Allows configuration of resource limits for processes of this user, see <citerefentry
643 project='man-pages'><refentrytitle>getrlimit</refentrytitle><manvolnum>2</manvolnum></citerefentry>
644 for details. Takes a resource limit name (e.g. <literal>LIMIT_NOFILE</literal>) followed by an equal
645 sign, followed by a numeric limit. Optionally, separated by colon a second numeric limit may be
646 specified. If two are specified this refers to the soft and hard limits, respectively. If only one
ec07c3c8
AK
647 limit is specified the setting sets both limits in one.</para>
648
649 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
650 </varlistentry>
651
652 <varlistentry>
653 <term><option>--tasks-max=</option><replaceable>TASKS</replaceable></term>
654
84a1ff94 655 <listitem><para>Takes a non-zero unsigned integer as argument. Configures the maximum number of tasks
8dc647fd
ZJS
656 (i.e. threads, where each process is at least one thread) the user may have at any given time. This
657 limit applies to all tasks forked off the user's sessions, even if they change user identity via
658 <citerefentry project='man-pages'><refentrytitle>su</refentrytitle><manvolnum>1</manvolnum></citerefentry>
659 or a similar tool. Use <option>--rlimit=LIMIT_NPROC=</option> to place a limit on the tasks actually
ea7a19e9 660 running under the UID of the user, thus excluding any child processes that might have changed user
86b52a39 661 identity. This controls the <varname>TasksMax=</varname> setting of the per-user systemd slice unit
ea7a19e9
LP
662 <filename>user-$UID.slice</filename>. See
663 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>
ec07c3c8
AK
664 for further details.</para>
665
666 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
667 </varlistentry>
668
669 <varlistentry>
670 <term><option>--memory-high=</option><replaceable>BYTES</replaceable></term>
671 <term><option>--memory-max=</option><replaceable>BYTES</replaceable></term>
672
673 <listitem><para>Set a limit on the memory a user may take up on a system at any given time in bytes
674 (the usual K, M, G, … suffixes are supported, to the base of 1024). This includes all memory used by
675 the user itself and all processes they forked off that changed user credentials. This controls the
676 <varname>MemoryHigh=</varname> and <varname>MemoryMax=</varname> settings of the per-user systemd
677 slice unit <filename>user-$UID.slice</filename>. See
678 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>
ec07c3c8
AK
679 for further details.</para>
680
681 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
682 </varlistentry>
683
684 <varlistentry>
685 <term><option>--cpu-weight=</option><replaceable>WEIGHT</replaceable></term>
686 <term><option>--io-weight=</option><replaceable>WEIGHT</replaceable></term>
687
24c8d4d3 688 <listitem><para>Set CPU and IO scheduling weights of the processes of the user, including those of
ea7a19e9
LP
689 processes forked off by the user that changed user credentials. Takes a numeric value in the range
690 1…10000. This controls the <varname>CPUWeight=</varname> and <varname>IOWeight=</varname> settings of
691 the per-user systemd slice unit <filename>user-$UID.slice</filename>. See
692 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>
ec07c3c8
AK
693 for further details.</para>
694
695 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
696 </varlistentry>
697
698 <varlistentry>
699 <term><option>--storage=</option><replaceable>STORAGE</replaceable></term>
700
701 <listitem><para>Selects the storage mechanism to use for this home directory. Takes one of
702 <literal>luks</literal>, <literal>fscrypt</literal>, <literal>directory</literal>,
703 <literal>subvolume</literal>, <literal>cifs</literal>. For details about these mechanisms, see
feb86ca9
LP
704 above. If a new home directory is created and the storage type is not specifically specified,
705 <citerefentry><refentrytitle>homed.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
ec07c3c8
AK
706 defines which default storage to use.</para>
707
708 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
709 </varlistentry>
710
711 <varlistentry>
712 <term><option>--image-path=</option><replaceable>PATH</replaceable></term>
713
714 <listitem><para>Takes a file system path. Configures where to place the user's home directory. When
715 LUKS2 storage is used refers to the path to the loopback file, otherwise to the path to the home
f9d525ae
LP
716 directory (which may be in <filename>/home/</filename> or any other accessible filesystem). When
717 unspecified defaults to <filename>/home/$USER.home</filename> when LUKS storage is used and
718 <filename>/home/$USER.homedir</filename> for the other storage mechanisms. Not defined for the
719 <literal>cifs</literal> storage mechanism. To use LUKS2 storage on a regular block device (for
720 example a USB stick) pass the path to the block device here. Specifying the path to a directory here
721 when using LUKS2 storage is not allowed. Similar, specifying the path to a regular file or device
ec07c3c8
AK
722 node is not allowed if any of the other storage backends are used.</para>
723
724 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
725 </varlistentry>
726
86019efa
LP
727 <varlistentry>
728 <term><option>--drop-caches=</option><replaceable>BOOL</replaceable></term>
729
730 <listitem><para>Automatically flush OS file system caches on logout. This is useful in combination
731 with the fscrypt storage backend to ensure the OS does not keep decrypted versions of the files and
732 directories in memory (and accessible) after logout. This option is also supported on other backends,
733 but should not bring any benefit there. Defaults to off, except if the selected storage backend is
734 fscrypt, where it defaults to on. Note that flushing OS caches will negatively influence performance
ec07c3c8
AK
735 of the OS shortly after logout.</para>
736
737 <xi:include href="version-info.xml" xpointer="v250"/></listitem>
86019efa
LP
738 </varlistentry>
739
ea7a19e9
LP
740 <varlistentry>
741 <term><option>--fs-type=</option><replaceable>TYPE</replaceable></term>
742
743 <listitem><para>When LUKS2 storage is used configures the file system type to use inside the home
caf6bd16
LP
744 directory LUKS2 container. One of <literal>btrfs</literal>, <literal>ext4</literal>,
745 <literal>xfs</literal>. If not specified
feb86ca9
LP
746 <citerefentry><refentrytitle>homed.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
747 defines which default file system type to use. Note that <literal>xfs</literal> is not recommended as
ec07c3c8
AK
748 its support for file system resizing is too limited.</para>
749
750 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
751 </varlistentry>
752
753 <varlistentry>
754 <term><option>--luks-discard=</option><replaceable>BOOL</replaceable></term>
755
756 <listitem><para>When LUKS2 storage is used configures whether to enable the
757 <literal>discard</literal> feature of the file system. If enabled the file system on top of the LUKS2
758 volume will report empty block information to LUKS2 and the loopback file below, ensuring that empty
759 space in the home directory is returned to the backing file system below the LUKS2 volume, resulting
760 in a "sparse" loopback file. This option mostly defaults to off, since this permits over-committing
761 home directories which results in I/O errors if the underlying file system runs full while the upper
762 file system wants to allocate a block. Such I/O errors are generally not handled well by file systems
763 nor applications. When LUKS2 storage is used on top of regular block devices (instead of on top a
ec07c3c8
AK
764 loopback file) the discard logic defaults to on.</para>
765
766 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
767 </varlistentry>
768
c0440512
LP
769 <varlistentry>
770 <term><option>--luks-offline-discard=</option><replaceable>BOOL</replaceable></term>
771
772 <listitem><para>Similar to <option>--luks-discard=</option>, controls the trimming of the file
773 system. However, while <option>--luks-discard=</option> controls what happens when the home directory
774 is active, <option>--luks-offline-discard=</option> controls what happens when it becomes inactive,
775 i.e. whether to trim/allocate the storage when deactivating the home directory. This option defaults
ec07c3c8
AK
776 to on, to ensure disk space is minimized while a user is not logged in.</para>
777
778 <xi:include href="version-info.xml" xpointer="v246"/></listitem>
5dd57a00
LP
779 </varlistentry>
780
781 <varlistentry>
782 <term><option>--luks-extra-mount-options=</option><replaceable>OPTIONS</replaceable></term>
783
784 <listitem><para>Takes a string containing additional mount options to use when mounting the LUKS
785 volume. If specified, this string will be appended to the default, built-in mount
ec07c3c8
AK
786 options.</para>
787
788 <xi:include href="version-info.xml" xpointer="v250"/></listitem>
c0440512
LP
789 </varlistentry>
790
ea7a19e9
LP
791 <varlistentry>
792 <term><option>--luks-cipher=</option><replaceable>CIPHER</replaceable></term>
793 <term><option>--luks-cipher-mode=</option><replaceable>MODE</replaceable></term>
b72308d3 794 <term><option>--luks-volume-key-size=</option><replaceable>BYTES</replaceable></term>
ea7a19e9
LP
795 <term><option>--luks-pbkdf-type=</option><replaceable>TYPE</replaceable></term>
796 <term><option>--luks-pbkdf-hash-algorithm=</option><replaceable>ALGORITHM</replaceable></term>
b04ff66b 797 <term><option>--luks-pbkdf-force-iterations=</option><replaceable>ITERATIONS</replaceable></term>
ea7a19e9
LP
798 <term><option>--luks-pbkdf-time-cost=</option><replaceable>SECONDS</replaceable></term>
799 <term><option>--luks-pbkdf-memory-cost=</option><replaceable>BYTES</replaceable></term>
800 <term><option>--luks-pbkdf-parallel-threads=</option><replaceable>THREADS</replaceable></term>
fd83c98e 801 <term><option>--luks-sector-size=</option><replaceable>BYTES</replaceable></term>
ea7a19e9
LP
802
803 <listitem><para>Configures various cryptographic parameters for the LUKS2 storage mechanism. See
804 <citerefentry
805 project='man-pages'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>
b72308d3
ZJS
806 for details on the specific attributes.</para>
807
808 <para>Note that <command>homectl</command> uses bytes for key size, like
809 <filename>/proc/crypto</filename>, but <citerefentry
810 project='man-pages'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>
811 uses bits.</para></listitem>
ea7a19e9
LP
812 </varlistentry>
813
2f09e2ee
LP
814 <varlistentry>
815 <term><option>--auto-resize-mode=</option></term>
816
817 <listitem><para>Configures whether to automatically grow and/or shrink the backing file system on
818 login and logout. Takes one of the strings <literal>off</literal>, <literal>grow</literal>,
819 <literal>shrink-and-grow</literal>. Only applies to the LUKS2 backend currently, and if the btrfs
820 file system is used inside it (since only then online growing/shrinking of the file system is
821 supported). Defaults to <literal>shrink-and-grow</literal>, if LUKS2/btrfs is used, otherwise is
822 off. If set to <literal>off</literal> no automatic shrinking/growing during login or logout is
823 done. If set to <literal>grow</literal> the home area is grown to the size configured via
824 <option>--disk-size=</option> should it currently be smaller. If it already matches the configured
825 size or is larger no operation is executed. If set to <literal>shrink-and-grow</literal> the home
fe003f02
ZJS
826 area is also resized during logout to the minimal size the used disk space and file system
827 constraints permit. This mode thus ensures that while a home area is activated it is sized to the
828 configured size, but while deactivated it is compacted taking up only the minimal space possible.
829 Note that if the system is powered off abnormally or if the user otherwise not logged out cleanly the
830 shrinking operation will not take place, and the user has to re-login/logout again before it is
ec07c3c8
AK
831 executed again.</para>
832
833 <xi:include href="version-info.xml" xpointer="v250"/></listitem>
2f09e2ee
LP
834 </varlistentry>
835
21505c93
LP
836 <varlistentry>
837 <term><option>--rebalance-weight=</option></term>
838
839 <listitem><para>Configures the weight parameter for the free disk space rebalancing logic. Only
840 applies to the LUKS2 backend (since for the LUKS2 backend disk space is allocated from a per-user
841 loopback file system instead of immediately from a common pool like the other backends do it). In
842 regular intervals free disk space in the active home areas and their backing storage is redistributed
843 among them, taking the weight value configured here into account. Expects an integer in the range
844 1…10000, or the special string <literal>off</literal>. If not specified defaults to 100. The weight
845 is used to scale free space made available to the home areas: a home area with a weight of 200 will
846 get twice the free space as one with a weight of 100; a home area with a weight of 50 will get half
847 of that. The backing file system will be assigned space for a weight of 20. If set to
848 <literal>off</literal> no automatic free space distribution is done for this home area. Note that
849 resizing the home area explicitly (with <command>homectl resize</command> see below) will implicitly
850 turn off the automatic rebalancing. To reenable the automatic rebalancing use
ec07c3c8
AK
851 <option>--rebalance-weight=</option> with an empty parameter.</para>
852
853 <xi:include href="version-info.xml" xpointer="v250"/></listitem>
21505c93
LP
854 </varlistentry>
855
ea7a19e9
LP
856 <varlistentry>
857 <term><option>--nosuid=</option><replaceable>BOOL</replaceable></term>
858 <term><option>--nodev=</option><replaceable>BOOL</replaceable></term>
859 <term><option>--noexec=</option><replaceable>BOOL</replaceable></term>
860
861 <listitem><para>Configures the <literal>nosuid</literal>, <literal>nodev</literal> and
862 <literal>noexec</literal> mount options for the home directories. By default <literal>nodev</literal>
863 and <literal>nosuid</literal> are on, while <literal>noexec</literal> is off. For details about these
864 mount options see <citerefentry
ec07c3c8
AK
865 project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
866
867 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
868 </varlistentry>
869
870 <varlistentry>
871 <term><option>--cifs-domain=</option><replaceable>DOMAIN</replaceable></term>
872 <term><option>--cifs-user-name=</option><replaceable>USER</replaceable></term>
873 <term><option>--cifs-service=</option><replaceable>SERVICE</replaceable></term>
4c2ee5c7 874 <term><option>--cifs-extra-mount-options=</option><replaceable>OPTIONS</replaceable></term>
ea7a19e9
LP
875
876 <listitem><para>Configures the Windows File Sharing (CIFS) domain and user to associate with the home
bf15879b
LP
877 directory/user account, as well as the file share ("service") to mount as directory. The latter is
878 used when <literal>cifs</literal> storage is selected. The file share should be specified in format
879 <literal>//<replaceable>host</replaceable>/<replaceable>share</replaceable>/<replaceable>directory/…</replaceable></literal>. The
880 directory part is optional — if not specified the home directory will be placed in the top-level
4c2ee5c7
LP
881 directory of the share. The <option>--cifs-extra-mount-options=</option> setting allows specifying
882 additional mount options when mounting the share, see <citerefentry
883 project='man-pages'><refentrytitle>mount.cifs</refentrytitle><manvolnum>8</manvolnum></citerefentry>
884 for details.</para></listitem>
ea7a19e9
LP
885 </varlistentry>
886
887 <varlistentry>
888 <term><option>--stop-delay=</option><replaceable>SECS</replaceable></term>
889
890 <listitem><para>Configures the time the per-user service manager shall continue to run after the all
891 sessions of the user ended. The default is configured in
892 <citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry> (for
893 home directories of LUKS2 storage located on removable media this defaults to 0 though). A longer
894 time makes sure quick, repetitive logins are more efficient as the user's service manager doesn't
ec07c3c8
AK
895 have to be started every time.</para>
896
897 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
898 </varlistentry>
899
900 <varlistentry>
901 <term><option>--kill-processes=</option><replaceable>BOOL</replaceable></term>
902
903 <listitem><para>Configures whether to kill all processes of the user on logout. The default is
904 configured in
ec07c3c8
AK
905 <citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
906
907 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
908 </varlistentry>
909
910 <varlistentry>
911 <term><option>--auto-login=</option><replaceable>BOOL</replaceable></term>
912
913 <listitem><para>Takes a boolean argument. Configures whether the graphical UI of the system should
914 automatically log this user in if possible. Defaults to off. If less or more than one user is marked
ec07c3c8
AK
915 this way automatic login is disabled.</para>
916
917 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
918 </varlistentry>
919 </variablelist>
920 </refsect1>
921
922 <refsect1>
923 <title>Commands</title>
924
925 <para>The following commands are understood:</para>
926
927 <variablelist>
928
929 <varlistentry>
930 <term><command>list</command></term>
931
932 <listitem><para>List all home directories (along with brief details) currently managed by
933 <filename>systemd-homed.service</filename>. This command is also executed if none is specified on the
934 command line. (Note that the list of users shown by this command does not include users managed by
935 other subsystems, such as system users or any traditional users listed in
ec07c3c8
AK
936 <filename>/etc/passwd</filename>.)</para>
937
938 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
939 </varlistentry>
940
941 <varlistentry>
942 <term><command>activate</command> <replaceable>USER</replaceable> [<replaceable>USER…</replaceable>]</term>
943
944 <listitem><para>Activate one or more home directories. The home directories of each listed user will
945 be activated and made available under their mount points (typically in
946 <filename>/home/$USER</filename>). Note that any home activated this way stays active indefinitely,
947 until it is explicitly deactivated again (with <command>deactivate</command>, see below), or the user
948 logs in and out again and it thus is deactivated due to the automatic deactivation-on-logout
949 logic.</para>
950
951 <para>Activation of a home directory involves various operations that depend on the selected storage
952 mechanism. If the LUKS2 mechanism is used, this generally involves: inquiring the user for a
953 password, setting up a loopback device, validating and activating the LUKS2 volume, checking the file
e9dd6984 954 system, mounting the file system, and potentially changing the ownership of all included files to the
ec07c3c8
AK
955 correct UID/GID.</para>
956
957 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
958 </varlistentry>
959
960 <varlistentry>
961 <term><command>deactivate</command> <replaceable>USER</replaceable> [<replaceable>USER…</replaceable>]</term>
962
963 <listitem><para>Deactivate one or more home directories. This undoes the effect of
ec07c3c8
AK
964 <command>activate</command>.</para>
965
966 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
967 </varlistentry>
968
969 <varlistentry>
970 <term><command>inspect</command> <replaceable>USER</replaceable> [<replaceable>USER…</replaceable>]</term>
971
972 <listitem><para>Show various details about the specified home directories. This shows various
973 information about the home directory and its user account, including runtime data such as current
974 state, disk use and similar. Combine with <option>--json=</option> to show the detailed JSON user
975 record instead, possibly combined with <option>--export-format=</option> to suppress certain aspects
ec07c3c8
AK
976 of the output.</para>
977
978 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
979 </varlistentry>
980
981 <varlistentry>
982 <term><command>authenticate</command> <replaceable>USER</replaceable> [<replaceable>USER…</replaceable>]</term>
983
984 <listitem><para>Validate authentication credentials of a home directory. This queries the caller for
985 a password (or similar) and checks that it correctly unlocks the home directory. This leaves the home
986 directory in the state it is in, i.e. it leaves the home directory in inactive state if it was
ec07c3c8
AK
987 inactive before, and in active state if it was active before.</para>
988
989 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
990 </varlistentry>
991
992 <varlistentry>
993 <term><command>create</command> <replaceable>USER</replaceable></term>
994 <term><command>create</command> <option>--identity=</option><replaceable>PATH</replaceable> <optional><replaceable>USER</replaceable></optional></term>
995
996 <listitem><para>Create a new home directory/user account of the specified name. Use the various
997 user record property options (as documented above) to control various aspects of the home directory
887a8fa3
LP
998 and its user accounts.</para>
999
1000 <para>The specified user name should follow the strict syntax described on <ulink
ec07c3c8
AK
1001 url="https://systemd.io/USER_NAMES">User/Group Name Syntax</ulink>.</para>
1002
1003 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
1004 </varlistentry>
1005
1006 <varlistentry>
1007 <term><command>remove</command> <replaceable>USER</replaceable></term>
1008
1009 <listitem><para>Remove a home directory/user account. This will remove both the home directory's user
1010 record and the home directory itself, and thus delete all files and directories owned by the
ec07c3c8
AK
1011 user.</para>
1012
1013 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
1014 </varlistentry>
1015
1016 <varlistentry>
1017 <term><command>update</command> <replaceable>USER</replaceable></term>
1018 <term><command>update</command> <option>--identity=</option><replaceable>PATH</replaceable> <optional><replaceable>USER</replaceable></optional></term>
1019
1020 <listitem><para>Update a home directory/user account. Use the various user record property options
1021 (as documented above) to make changes to the account, or alternatively provide a full, updated JSON
1022 user record via the <option>--identity=</option> option.</para>
1023
1024 <para>Note that changes to user records not signed by a cryptographic private key available locally
1025 are not permitted, unless <option>--identity=</option> is used with a user record that is already
ec07c3c8
AK
1026 correctly signed by a recognized private key.</para>
1027
1028 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
1029 </varlistentry>
1030
1031 <varlistentry>
1032 <term><command>passwd</command> <replaceable>USER</replaceable></term>
1033
ec07c3c8
AK
1034 <listitem><para>Change the password of the specified home directory/user account.</para>
1035
1036 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
1037 </varlistentry>
1038
1039 <varlistentry>
1040 <term><command>resize</command> <replaceable>USER</replaceable> <replaceable>BYTES</replaceable></term>
1041
1042 <listitem><para>Change the disk space assigned to the specified home directory. If the LUKS2 storage
1043 mechanism is used this will automatically resize the loopback file and the file system contained
1044 within. Note that if <literal>ext4</literal> is used inside of the LUKS2 volume, it is necessary to
1045 deactivate the home directory before shrinking it (i.e the user has to log out). Growing can be done
1046 while the home directory is active. If <literal>xfs</literal> is used inside of the LUKS2 volume the
1047 home directory may not be shrunk whatsoever. On all three of <literal>ext4</literal>,
1048 <literal>xfs</literal> and <literal>btrfs</literal> the home directory may be grown while the user is
1049 logged in, and on the latter also shrunk while the user is logged in. If the
1050 <literal>subvolume</literal>, <literal>directory</literal>, <literal>fscrypt</literal> storage
9f5827e0
LP
1051 mechanisms are used, resizing will change file system quota. The size parameter may make use of the
1052 usual suffixes B, K, M, G, T (to the base of 1024). The special strings <literal>min</literal> and
1053 <literal>max</literal> may be specified in place of a numeric size value, for minimizing or
1054 maximizing disk space assigned to the home area, taking constraints of the file system, disk usage inside
ec07c3c8
AK
1055 the home area and on the backing storage into account.</para>
1056
1057 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
1058 </varlistentry>
1059
1060 <varlistentry>
1061 <term><command>lock</command> <replaceable>USER</replaceable></term>
1062
1063 <listitem><para>Temporarily suspend access to the user's home directory and remove any associated
1064 cryptographic keys from memory. Any attempts to access the user's home directory will stall until the
1065 home directory is unlocked again (i.e. re-authenticated). This functionality is primarily intended to
1066 be used during system suspend to make sure the user's data cannot be accessed until the user
1067 re-authenticates on resume. This operation is only defined for home directories that use the LUKS2
ec07c3c8
AK
1068 storage mechanism.</para>
1069
1070 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
1071 </varlistentry>
1072
1073 <varlistentry>
1074 <term><command>unlock</command> <replaceable>USER</replaceable></term>
1075
1076 <listitem><para>Resume access to the user's home directory again, undoing the effect of
1077 <command>lock</command> above. This requires authentication of the user, as the cryptographic keys
ec07c3c8
AK
1078 required for access to the home directory need to be reacquired.</para>
1079
1080 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
1081 </varlistentry>
1082
1083 <varlistentry>
1084 <term><command>lock-all</command></term>
1085
1086 <listitem><para>Execute the <command>lock</command> command on all suitable home directories at
1087 once. This operation is generally executed on system suspend (i.e. by <command>systemctl
1088 suspend</command> and related commands), to ensure all active user's cryptographic keys for accessing
ec07c3c8
AK
1089 their home directories are removed from memory.</para>
1090
1091 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9
LP
1092 </varlistentry>
1093
d1f6e01e
LP
1094 <varlistentry>
1095 <term><command>deactivate-all</command></term>
1096
1097 <listitem><para>Execute the <command>deactivate</command> command on all active home directories at
1098 once. This operation is generally executed on system shut down (i.e. by <command>systemctl
1099 poweroff</command> and related commands), to ensure all active user's home directories are fully
ec07c3c8
AK
1100 deactivated before <filename>/home/</filename> and related file systems are unmounted.</para>
1101
1102 <xi:include href="version-info.xml" xpointer="v247"/></listitem>
d1f6e01e
LP
1103 </varlistentry>
1104
ea7a19e9
LP
1105 <varlistentry>
1106 <term><command>with</command> <replaceable>USER</replaceable> <replaceable>COMMAND…</replaceable></term>
1107
1108 <listitem><para>Activate the specified user's home directory, run the specified command (under the
1109 caller's identity, not the specified user's) and deactivate the home directory afterwards again
1110 (unless the user is logged in otherwise). This command is useful for running privileged backup
1111 scripts and such, but requires authentication with the user's credentials in order to be able to
ec07c3c8
AK
1112 unlock the user's home directory.</para>
1113
1114 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
ea7a19e9 1115 </varlistentry>
6d6d4459
LP
1116
1117 <varlistentry>
1118 <term><command>rebalance</command></term>
1119
1120 <listitem><para>Rebalance free disk space between active home areas and the backing storage. See
1121 <option>--rebalance-weight=</option> above. This executes no operation unless there's at least one
1122 active LUKS2 home area that has disk space rebalancing enabled. This operation is synchronous: it
1123 will only complete once disk space is rebalanced according to the rebalancing weights. Note that
1124 rebalancing also takes place automatically in the background in regular intervals. Use this command
1125 to synchronously ensure disk space is properly redistributed before initiating an operation requiring
ec07c3c8
AK
1126 large amounts of disk space.</para>
1127
1128 <xi:include href="version-info.xml" xpointer="v250"/></listitem>
6d6d4459 1129 </varlistentry>
ea7a19e9
LP
1130 </variablelist>
1131 </refsect1>
1132
1133 <refsect1>
1134 <title>Exit status</title>
1135
1136 <para>On success, 0 is returned, a non-zero failure code otherwise.</para>
b9bfa250
ZJS
1137
1138 <para>When a command is invoked with <command>with</command>, the exit status of the child is
1139 propagated. Effectively, <command>homectl</command> will exit without error if the command is
1140 successfully invoked <emphasis>and</emphasis> finishes successfully.</para>
ea7a19e9
LP
1141 </refsect1>
1142
4ef3ca34 1143 <xi:include href="common-variables.xml" />
ea7a19e9
LP
1144
1145 <refsect1>
1146 <title>Examples</title>
1147
1148 <example>
1149 <title>Create a user <literal>waldo</literal> in the administrator group <literal>wheel</literal>, and
1150 assign 500 MiB disk space to them.</title>
1151
1152 <programlisting>homectl create waldo --real-name="Waldo McWaldo" -G wheel --disk-size=500M</programlisting>
1153 </example>
1154
1155 <example>
1156 <title>Create a user <literal>wally</literal> on a USB stick, and assign a maximum of 500 concurrent
1157 tasks to them.</title>
1158
1159 <programlisting>homectl create wally --real-name="Wally McWally" --image-path=/dev/disk/by-id/usb-SanDisk_Ultra_Fit_476fff954b2b5c44-0:0 --tasks-max=500</programlisting>
1160 </example>
1161
1162 <example>
1163 <title>Change nice level of user <literal>odlaw</literal> to +5 and make sure the environment variable
1164 <varname>$SOME</varname> is set to the string <literal>THING</literal> for them on login.</title>
1165
1166 <programlisting>homectl update odlaw --nice=5 --setenv=SOME=THING</programlisting>
1167 </example>
1168
1169 <example>
4442c269 1170 <title>Set up authentication with a YubiKey security token using PKCS#11/PIV:</title>
ea7a19e9
LP
1171
1172 <programlisting># Clear the Yubikey from any old keys (careful!)
1173ykman piv reset
1174
1175# Generate a new private/public key pair on the device, store the public key in 'pubkey.pem'.
1176ykman piv generate-key -a RSA2048 9d pubkey.pem
1177
1178# Create a self-signed certificate from this public key, and store it on the device.
1179ykman piv generate-certificate --subject "Knobelei" 9d pubkey.pem
1180
4442c269 1181# We don't need the public key on disk anymore
ea7a19e9
LP
1182rm pubkey.pem
1183
4442c269
LP
1184# Allow the security token to unlock the account of user 'lafcadio'.
1185homectl update lafcadio --pkcs11-token-uri=auto</programlisting>
1186 </example>
1187
1188 <example>
1189 <title>Set up authentication with a FIDO2 security token:</title>
ea7a19e9 1190
4442c269
LP
1191 <programlisting># Allow a FIDO2 security token to unlock the account of user 'nihilbaxter'.
1192homectl update nihilbaxter --fido2-device=auto</programlisting>
ea7a19e9
LP
1193 </example>
1194 </refsect1>
1195
1196 <refsect1>
1197 <title>See Also</title>
1198 <para>
1199 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1200 <citerefentry><refentrytitle>systemd-homed.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
feb86ca9 1201 <citerefentry><refentrytitle>homed.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
ea7a19e9
LP
1202 <citerefentry><refentrytitle>userdbctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1203 <citerefentry project='man-pages'><refentrytitle>useradd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
1204 <citerefentry project='man-pages'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>
1205 </para>
1206 </refsect1>
1207
1208</refentry>