Debian Codegraph @

man/homectl.xml

raw
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.5/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
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 <refname>systemd-homed-firstboot.service</refname>
22 <refpurpose>Create, remove, change or inspect home directories</refpurpose>
23 </refnamediv>
24
25 <refsynopsisdiv>
26 <cmdsynopsis>
27 <command>homectl</command>
28 <arg choice="opt" rep="repeat">OPTIONS</arg>
29 <arg choice="req">COMMAND</arg>
30 <arg choice="opt" rep="repeat">NAME</arg>
31 </cmdsynopsis>
32 </refsynopsisdiv>
33
34 <refsect1>
35 <title>Description</title>
36
37 <para><command>homectl</command> may be used to create, remove, change or inspect a user's home
38 directory. It's primarily a command interfacing with
39 <citerefentry><refentrytitle>systemd-homed.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
40 which manages home directories of users.</para>
41
42 <para>Home directories managed by <filename>systemd-homed.service</filename> are self-contained, and thus
43 include the user's full metadata record in the home's data storage itself, making them easy to migrate
44 between machines. In particular, a home directory describes a matching user record, and every user record
45 managed by <filename>systemd-homed.service</filename> also implies existence and encapsulation of a home
46 directory. The user account and home directory become the same concept.</para>
47
48 <para>The following backing storage mechanisms are supported:</para>
49
50 <itemizedlist>
51 <listitem><para>An individual LUKS2 encrypted loopback file for a user, stored in
52 <filename>/home/*.home</filename>. At login the file system contained in this files is mounted, after
53 the LUKS2 encrypted volume has been attached. The user's password is identical to the encryption
54 passphrase of the LUKS2 volume. Access to data without preceding user authentication is thus not
55 possible, even for the system administrator. This storage mechanism provides the strongest data
56 security and is thus recommended.</para></listitem>
57
58 <listitem><para>Similar, but the LUKS2 encrypted file system is located on regular block device, such
59 as a USB storage stick. In this mode home directories and all data they include are nicely migratable
60 between machines, simply by plugging the USB stick into different systems at different
61 times.</para></listitem>
62
63 <listitem><para>An encrypted directory using <literal>fscrypt</literal> on file systems that support it
64 (at the moment this is primarily <literal>ext4</literal>), located in
65 <filename>/home/*.homedir</filename>. This mechanism also provides encryption, but substantially
66 weaker than LUKS2, as most file system metadata is unprotected. Moreover
67 it currently does not support changing user passwords once the home directory has been
68 created.</para></listitem>
69
70 <listitem><para>A <literal>btrfs</literal> subvolume for each user, also located in
71 <filename>/home/*.homedir</filename>. This provides no encryption, but good quota
72 support.</para></listitem>
73
74 <listitem><para>A regular directory for each user, also located in
75 <filename>/home/*.homedir</filename>. This provides no encryption, but is a suitable fallback
76 available on all machines, even where LUKS2, <literal>fscrypt</literal> or <literal>btrfs</literal>
77 support is not available.</para></listitem>
78
79 <listitem><para>An individual Windows file share (CIFS) for each user.</para></listitem>
80 </itemizedlist>
81
82 <para>Note that <filename>systemd-homed.service</filename> and <command>homectl</command> will not manage
83 "classic" UNIX user accounts as created with <citerefentry
84 project='man-pages'><refentrytitle>useradd</refentrytitle><manvolnum>8</manvolnum></citerefentry> or
85 similar tools. In particular, this functionality is not suitable for managing system users (i.e. users
86 with a UID below 1000) but is exclusive to regular ("human") users.</para>
87
88 <para>Note that users/home directories managed via <command>systemd-homed.service</command> do not show
89 up in <filename>/etc/passwd</filename> and similar files, they are synthesized via glibc NSS during
90 runtime. They are thus resolvable and may be enumerated via the <citerefentry
91 project='man-pages'><refentrytitle>getent</refentrytitle><manvolnum>1</manvolnum></citerefentry>
92 tool.</para>
93
94 <para>This tool interfaces directly with <filename>systemd-homed.service</filename>, and may execute
95 specific commands on the home directories it manages. Since every home directory managed that way also
96 defines a JSON user and group record these home directories may also be inspected and enumerated via
97 <citerefentry><refentrytitle>userdbctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>.</para>
98
99 <para>Home directories managed by <filename>systemd-homed.service</filename> are usually in one of two
100 states, or in a transition state between them: when <literal>active</literal> they are unlocked and
101 mounted, and thus accessible to the system and its programs; when <literal>inactive</literal> they are
102 not mounted and thus not accessible. Activation happens automatically at login of the user and usually
103 can only complete after a password (or other authentication token) has been supplied. Deactivation
104 happens after the user fully logged out. A home directory remains active as long as the user is logged in
105 at least once, i.e. has at least one login session. When the user logs in a second time simultaneously
106 the home directory remains active. It is deactivated only after the last of the user's sessions
107 ends.</para>
108 </refsect1>
109
110 <refsect1>
111 <title>Options</title>
112
113 <para>The following general options are understood (further options that control the various properties
114 of user records managed by <filename>systemd-homed.service</filename> are documented further
115 down):</para>
116
117 <variablelist>
118
119 <varlistentry>
120 <term><option>--identity=<replaceable>FILE</replaceable></option></term>
121
122 <listitem><para>Read the user's JSON record from the specified file. If passed as
123 <literal>-</literal> read the user record from standard input. The supplied JSON object must follow
124 the structure documented in <ulink url="https://systemd.io/USER_RECORD">JSON User Records</ulink>.
125 This option may be used in conjunction with the <command>create</command> and
126 <command>update</command> commands (see below), where it allows configuring the user record in JSON
127 as-is, instead of setting the individual user record properties (see below).</para>
128
129 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
130 </varlistentry>
131
132 <varlistentry>
133 <term><option>--json=<replaceable>FORMAT</replaceable></option></term>
134 <term><option>-j</option></term>
135
136 <listitem><para>Controls whether to output the user record in JSON format, if the
137 <command>inspect</command> command (see below) is used. Takes one of <literal>pretty</literal>,
138 <literal>short</literal> or <literal>off</literal>. If <literal>pretty</literal> human-friendly
139 whitespace and newlines are inserted in the output to make the JSON data more readable. If
140 <literal>short</literal> all superfluous whitespace is suppressed. If <literal>off</literal> (the
141 default) the user information is not shown in JSON format but in a friendly human-readable formatting
142 instead. The <option>-j</option> option picks <literal>pretty</literal> when run interactively and
143 <literal>short</literal> otherwise.</para>
144
145 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
146 </varlistentry>
147
148 <varlistentry>
149 <term><option>--export-format=<replaceable>FORMAT</replaceable></option></term>
150 <term><option>-E</option></term>
151 <term><option>-EE</option></term>
152
153 <listitem><para>When used with the <command>inspect</command> verb in JSON mode (see above) may be
154 used to suppress certain aspects of the JSON user record on output. Specifically, if
155 <literal>stripped</literal> format is used the binding and runtime fields of the record are
156 removed. If <literal>minimal</literal> format is used the cryptographic signature is removed too. If
157 <literal>full</literal> format is used the full JSON record is shown (this is the default). This
158 option is useful for copying an existing user record to a different system in order to create a
159 similar user there with the same settings. Specifically: <command>homectl inspect -EE | ssh
160 root@othersystem homectl create -i-</command> may be used as simple command line for replicating a
161 user on another host. <option>-E</option> is equivalent to <option>-j --export-format=stripped</option>,
162 <option>-EE</option> to <option>-j --export-format=minimal</option>. Note that when replicating user
163 accounts user records acquired in <literal>stripped</literal> mode will retain the original
164 cryptographic signatures and thus may only be modified when the private key to update them is available
165 on the destination machine. When replicating users in <literal>minimal</literal> mode, the signature
166 is removed during the replication and thus the record will be implicitly signed with the key of the destination
167 machine and may be updated there without any private key replication.</para>
168
169 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
170 </varlistentry>
171
172 <varlistentry>
173 <term><option>--offline</option></term>
174
175 <listitem><para>Do not attempt to update the copy of the user record and blob directory that is embedded inside
176 of the home area. This allows for operation on home areas that are absent, or without needing to authenticate as
177 the user being modified.</para>
178
179 <xi:include href="version-info.xml" xpointer="v256"/></listitem>
180 </varlistentry>
181
182 <varlistentry>
183 <term><option>--key-name=</option></term>
184
185 <listitem><para>When used with the <command>add-signing-key</command> command, specify or override
186 the name under which to store the public key being added. The specified name can be chosen freely,
187 but must be suffixed with <literal>.public</literal>. If this option is not used the name is derived
188 from the specified filename. If a key is read from standard input this option is mandatory in order
189 to provide a suitable name for the key being added.</para>
190
191 <xi:include href="version-info.xml" xpointer="v258"/></listitem>
192 </varlistentry>
193
194 <varlistentry>
195 <term><option>--seize=</option></term>
196
197 <listitem><para>Takes a boolean argument. When used with <command>create</command> or
198 <command>register</command>, controls whether to strip cryptographic signatures from the provided
199 JSON user records, which has the effect of signing them with the local signing key
200 (<filename>local.public</filename>) instead. If this switch is set to true, added user records
201 hence become locally managed (and thus can be modified locally), while if it is set to false the user
202 records remain managed and owned by its origin (and thus cannot be modified locally). This switch
203 defaults to true for <command>create</command> and false for <command>register</command>.</para>
204
205 <xi:include href="version-info.xml" xpointer="v258"/></listitem>
206 </varlistentry>
207
208 <varlistentry>
209 <term><option>--prompt-new-user</option></term>
210
211 <listitem><para>If used in conjunction with <command>firstboot</command> and no regular user account
212 exists on the system so far the tool will interactively query for user information and create an
213 account.</para>
214
215 <xi:include href="version-info.xml" xpointer="v256"/></listitem>
216 </varlistentry>
217
218 <varlistentry>
219 <term><option>--prompt-shell=</option></term>
220
221 <listitem><para>Takes a boolean argument. Controls whether to interactively query for a login shell,
222 if <command>firstboot --prompt-new-user</command> is used. Defaults to true.</para>
223
224 <xi:include href="version-info.xml" xpointer="v259"/></listitem>
225 </varlistentry>
226
227 <varlistentry>
228 <term><option>--prompt-groups=</option></term>
229
230 <listitem><para>Takes a boolean argument. Controls whether to interactively query for auxiliary
231 groups to add the new user to, if <command>firstboot --prompt-new-user</command> is used. Defaults to
232 true.</para>
233
234 <xi:include href="version-info.xml" xpointer="v259"/></listitem>
235 </varlistentry>
236
237 <varlistentry>
238 <term><option>--chrome=</option></term>
239
240 <listitem><para>Takes a boolean argument. By default the interactive user creation via
241 <command>firstboot --prompt-new-user</command> screen will show reverse color "chrome" bars at the
242 top and and the bottom of the terminal screen, which may be disabled by setting this option to
243 false.</para>
244
245 <xi:include href="version-info.xml" xpointer="v259"/></listitem>
246 </varlistentry>
247
248 <varlistentry>
249 <term><option>--mute-console=</option></term>
250
251 <listitem><para>Takes a boolean argument. If true kernel log output and service manager status output
252 to the system console is temporarily disabled while <command>firstboot --prompt-new-user</command> is
253 running, so that its own output is not interrupted. Defaults to false.</para>
254
255 <xi:include href="version-info.xml" xpointer="v259"/></listitem>
256 </varlistentry>
257
258 <varlistentry>
259 <term><option>--match=this|other|any|auto</option></term>
260 <term><option>-A</option></term>
261 <term><option>-N</option></term>
262 <term><option>-T</option></term>
263
264 <listitem><para>Option <option>--match=</option> takes one of <literal>this</literal>,
265 <literal>other</literal>, <literal>any</literal> or <literal>auto</literal>. Some user record
266 settings can be defined to match only specific machines, or all machines but one, or all machines.
267 With this switch it is possibly to control to which machines to apply the settings appearing on the
268 command line after it. If <literal>this</literal> is specified the setting will only apply to the
269 local system (positive match), if <literal>other</literal> it will apply to all but the local system
270 (negative match), if <literal>any</literal> it will apply to all systems (unless there's a matching
271 positive or negative per-machine setting). If <literal>auto</literal> returns to the default logic:
272 whether a setting applies by default to the local system or all systems depends on the option in
273 question.</para>
274
275 <para>Note that only some user record settings can be conditioned like this. This option has no
276 effect on the others and is ignored there. This option may appear multiple times in a single command
277 line to apply settings conditioned by different matches to the same user record. See <ulink
278 url="https://systemd.io/USER_RECORD">JSON User Records</ulink> for details on which settings may be
279 used with such per-machine matching and which ones may not.</para>
280
281 <para><option>-A</option> is a shortcut for <option>--match=any</option>, <option>-T</option> is
282 short for <option>--match=this</option> and <option>-N</option> is short for
283 <option>--match=other</option>.</para>
284
285 <para>Here's an example call that sets the storage field to <literal>luks</literal> on the local
286 system, but to <literal>cifs</literal> on all others:</para>
287
288 <programlisting># homectl update lennart -T --storage=luks -N --storage=cifs</programlisting>
289
290 <xi:include href="version-info.xml" xpointer="v258"/></listitem>
291 </varlistentry>
292
293 <xi:include href="user-system-options.xml" xpointer="host" />
294 <xi:include href="user-system-options.xml" xpointer="machine" />
295
296 <xi:include href="standard-options.xml" xpointer="no-pager" />
297 <xi:include href="standard-options.xml" xpointer="no-legend" />
298 <xi:include href="standard-options.xml" xpointer="no-ask-password" />
299 <xi:include href="standard-options.xml" xpointer="help" />
300 <xi:include href="standard-options.xml" xpointer="version" />
301 </variablelist>
302 </refsect1>
303
304 <refsect1>
305 <title>General User Record Properties</title>
306
307 <para>The following options control various properties of the user records/home directories that
308 <filename>systemd-homed.service</filename> manages. These switches may be used in conjunction with the
309 <command>create</command> and <command>update</command> commands for configuring various aspects of the
310 home directory and the user account:</para>
311
312 <variablelist>
313
314 <varlistentry>
315 <term><option>--real-name=<replaceable>NAME</replaceable></option></term>
316 <term><option>-c</option> <replaceable>NAME</replaceable></term>
317
318 <listitem><para>The real name for the user. This corresponds with the GECOS field on classic UNIX NSS
319 records.</para>
320
321 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
322 </varlistentry>
323
324 <varlistentry>
325 <term><option>--realm=<replaceable>REALM</replaceable></option></term>
326
327 <listitem><para>The realm for the user. The realm associates a user with a specific organization or
328 installation, and allows distinguishing users of the same name defined in different contexts. The
329 realm can be any string that also qualifies as valid DNS domain name, and it is recommended to use
330 the organization's or installation's domain name for this purpose, but this is not enforced nor
331 required. On each system only a single user of the same name may exist, and if a user with the same
332 name and realm is seen it is assumed to refer to the same user while a user with the same name but
333 different realm is considered a different user. Note that this means that two users sharing the same
334 name but with distinct realms are not allowed on the same system. Assigning a realm to a user is
335 optional.</para>
336
337 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
338 </varlistentry>
339
340 <varlistentry>
341 <term><option>--alias=<replaceable>NAME</replaceable><optional>,<replaceable>NAME…</replaceable></optional></option></term>
342
343 <listitem><para>Additional names for the user. Takes one or more valid UNIX user names, separated by
344 commas. May be used multiple times to define multiple aliases. An alias username may be specified
345 wherever the primary user name may be specified, and resolves to the same user record.</para>
346
347 <xi:include href="version-info.xml" xpointer="v258"/></listitem>
348 </varlistentry>
349
350 <varlistentry>
351 <term><option>--email-address=<replaceable>EMAIL</replaceable></option></term>
352
353 <listitem><para>Takes an electronic mail address to associate with the user. On log-in the
354 <varname>$EMAIL</varname> environment variable is initialized from this value.</para>
355
356 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
357 </varlistentry>
358
359 <varlistentry>
360 <term><option>--location=<replaceable>TEXT</replaceable></option></term>
361
362 <listitem><para>Takes location specification for this user. This is free-form text, which might or
363 might not be usable by geo-location applications. Example: <option>--location="Berlin,
364 Germany"</option> or <option>--location="Basement, Room 3a"</option></para>
365
366 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
367 </varlistentry>
368
369 <varlistentry>
370 <term><option>--birth-date=<optional><replaceable>DATE</replaceable></optional></option></term>
371
372 <listitem><para>Takes a birth date for the user in ISO 8601 calendar date format
373 (<literal>YYYY-MM-DD</literal>). The earliest representable year is 1900. If an empty string is
374 passed the birth date is reset to unset.</para>
375
376 <xi:include href="version-info.xml" xpointer="v261"/></listitem>
377 </varlistentry>
378
379 <varlistentry>
380 <term><option>--icon-name=<replaceable>ICON</replaceable></option></term>
381
382 <listitem><para>Takes an icon name to associate with the user, following the scheme defined by the <ulink
383 url="https://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html">Icon Naming
384 Specification</ulink>.</para>
385
386 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
387 </varlistentry>
388
389 <varlistentry>
390 <term><option>--home-dir=<replaceable>PATH</replaceable></option></term>
391 <term><option>-d<replaceable>PATH</replaceable></option></term>
392
393 <listitem><para>Takes a path to use as home directory for the user. Note that this is the directory
394 the user's home directory is mounted to while the user is logged in. This is not where the user's
395 data is actually stored, see <option>--image-path=</option> for that. If not specified, defaults to
396 <filename>/home/$USER</filename>.</para>
397
398 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
399 </varlistentry>
400
401 <varlistentry>
402 <term><option>--uid=<replaceable>UID</replaceable></option></term>
403
404 <listitem><para>Takes a preferred numeric UNIX UID to assign this user. If a user is to be created
405 with the specified UID and it is already taken by a different user on the local system then creation
406 of the home directory is refused. Note though, if after creating the home directory it is used on a
407 different system and the configured UID is taken by another user there, then
408 <command>systemd-homed</command> may assign the user a different UID on that system. The specified
409 UID must be outside of the system user range. It is recommended to use the 60001…60513 UID range for
410 this purpose. If not specified, the UID is automatically picked. If the home directory is found to be
411 owned by a different UID when logging in, the home directory and everything underneath it will have
412 its ownership changed automatically before login completes.</para>
413
414 <para>Note that changing this option for existing home directories generally has no effect on home
415 directories that already have been registered locally (have a local <emphasis>binding</emphasis>), as
416 the UID used for an account on the local system is determined when the home directory is first
417 activated on it, and then remains in effect until the home directory is removed.</para>
418
419 <para>Note that users managed by <command>systemd-homed</command> always have a matching group
420 associated with the same name as well as a GID matching the UID of the user. Thus, configuring the
421 GID separately is not permitted.</para>
422
423 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
424 </varlistentry>
425
426 <varlistentry>
427 <term><option>--member-of=<replaceable>GROUP</replaceable></option></term>
428 <term><option>-G</option> <replaceable>GROUP</replaceable></term>
429
430 <listitem><para>Takes a comma-separated list of auxiliary UNIX groups this user shall belong
431 to. Example: <option>--member-of=wheel</option> to provide the user with administrator
432 privileges. Note that <command>systemd-homed</command> does not manage any groups besides a group
433 matching the user in name and numeric UID/GID. Thus any groups listed here must be registered
434 independently, for example with <citerefentry
435 project='man-pages'><refentrytitle>groupadd</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
436 Any non-existent groups are ignored. This option may be used more than once, in which case all
437 specified group lists are combined. If the user is currently a member of a group which is not listed,
438 the user will be removed from the group.</para>
439
440 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
441 </varlistentry>
442
443 <varlistentry>
444 <term><option>--capability-bounding-set=<replaceable>CAPABILITIES</replaceable></option></term>
445 <term><option>--capability-ambient-set=<replaceable>CAPABILITIES</replaceable></option></term>
446
447 <listitem><para>These options take a space separated list of process capabilities
448 (e.g. <constant>CAP_WAKE_ALARM</constant>, <constant>CAP_BLOCK_SUSPEND</constant>, …) that shall be
449 set in the capability bounding and ambient sets for all the user's sessions. See <citerefentry
450 project='man-pages'><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry>
451 for details on the capabilities concept. These options may be used more than once, in which case the
452 specified lists are combined. If the parameter begins with a <literal>~</literal> character the
453 effect is inverted: the specified capability is dropped from the specific set.</para>
454
455 <xi:include href="version-info.xml" xpointer="v254"/></listitem>
456 </varlistentry>
457
458
459 <varlistentry>
460 <term><option>--access-mode=<replaceable>MODE</replaceable></option></term>
461
462 <listitem><para>Takes a UNIX file access mode written in octal. Configures the access mode of the
463 home directory itself. Note that this is only used when the directory is first created, and the user
464 may change this any time afterwards. Example:
465 <option>--access-mode=0700</option></para>
466
467 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
468 </varlistentry>
469
470 <varlistentry>
471 <term><option>--umask=<replaceable>MASK</replaceable></option></term>
472
473 <listitem><para>Takes the access mode mask (in octal syntax) to apply to newly created files and
474 directories of the user ("umask"). If set this controls the initial umask set for all login sessions of
475 the user, possibly overriding the system's defaults.</para>
476
477 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
478 </varlistentry>
479
480 <varlistentry>
481 <term><option>--skel=<replaceable>PATH</replaceable></option></term>
482
483 <listitem><para>Takes a file system path to a directory. Specifies the skeleton directory to
484 initialize the home directory with. All files and directories in the specified path are copied into
485 any newly create home directory. If not specified, defaults to <filename>/etc/skel/</filename>.
486 </para>
487
488 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
489 </varlistentry>
490
491 <varlistentry>
492 <term><option>--shell=<replaceable>SHELL</replaceable></option></term>
493
494 <listitem><para>Takes a file system path. Specifies the shell binary to execute on terminal
495 logins. If not specified, defaults to <filename>/bin/bash</filename>.</para>
496
497 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
498 </varlistentry>
499
500 <varlistentry>
501 <term><option>--setenv=<replaceable>VARIABLE</replaceable>[=<replaceable>VALUE</replaceable>]</option></term>
502
503 <listitem><para>Takes an environment variable assignment to set for all user processes. May be used
504 multiple times to set multiple environment variables. When <literal>=</literal> and
505 <replaceable>VALUE</replaceable> are omitted, the value of the variable with the same name in the
506 program environment will be used.</para>
507
508 <para>Note that a number of other settings also result in environment variables to be set for the
509 user, including <option>--email=</option>, <option>--timezone=</option> and
510 <option>--language=</option>.</para>
511
512 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
513 </varlistentry>
514
515 <varlistentry>
516 <term><option>--timezone=<replaceable>TIMEZONE</replaceable></option></term>
517
518 <listitem><para>Takes a time zone location name that sets the timezone for the specified user. When
519 the user logs in the <varname>$TZ</varname> environment variable is initialized from this
520 setting. Example: <option>--timezone=Europe/Amsterdam</option> will result in the environment
521 variable <literal>TZ=:Europe/Amsterdam</literal>. (<literal>:</literal> is used intentionally as part
522 of the timezone specification, see
523 <citerefentry project='man-pages'><refentrytitle>tzset</refentrytitle><manvolnum>3</manvolnum></citerefentry>.)
524 </para>
525
526 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
527 </varlistentry>
528
529 <varlistentry>
530 <term><option>--language=<replaceable>LANG</replaceable></option></term>
531
532 <listitem><para>Takes a comma- or colon-separated list of languages preferred by the user, ordered
533 by descending priority. The <varname>$LANG</varname> and <varname>$LANGUAGE</varname> environment
534 variables are initialized from this value on login, and thus values suitable for these environment
535 variables are accepted here, for example <option>--language=de_DE.UTF-8</option>. This option may
536 be used more than once, in which case the language lists are concatenated.</para>
537
538 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
539 </varlistentry>
540
541 <varlistentry>
542 <term><option>--default-area=<replaceable>AREA</replaceable></option></term>
543
544 <listitem><para>Takes a string identifying a home directory "area" to use as default. Areas are
545 secondary home directories within the primary home directory of a user. When logging in a user can
546 specify the area they wish to log into, which ensures that the <varname>$HOME</varname> environment
547 variable is set to <filename>~/Areas/</filename> suffixed by the area name.</para>
548
549 <para>For details on the area concept see
550 <citerefentry><refentrytitle>pam_systemd_home</refentrytitle><manvolnum>8</manvolnum></citerefentry>. Note
551 that this option just defines the default, which can be overridden at login time.</para>
552
553 <para>When this option is specified with an empty string as value any previously declared default area
554 is removed from the user record.</para>
555
556 <xi:include href="version-info.xml" xpointer="v258"/></listitem>
557 </varlistentry>
558 </variablelist>
559 </refsect1>
560
561 <refsect1>
562 <title>Authentication User Record Properties</title>
563 <variablelist>
564 <varlistentry>
565 <term><option>--ssh-authorized-keys=<replaceable>KEYS</replaceable></option></term>
566 <listitem><para>Either takes a SSH authorized key line to associate with the user record or a
567 <literal>@</literal> character followed by a path to a file to read one or more such lines from. SSH
568 keys configured this way are made available to SSH to permit access to this home directory and user
569 record. This option may be used more than once to configure multiple SSH keys.</para>
570
571 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
572 </varlistentry>
573
574 <varlistentry>
575 <term><option>--pkcs11-token-uri=<replaceable>URI</replaceable></option></term>
576 <listitem><para>Takes an RFC 7512 PKCS#11 URI referencing a security token (e.g. YubiKey or PIV
577 smartcard) that shall be able to unlock the user account. The security token URI should reference a
578 security token with exactly one pair of X.509 certificate and private key. A random secret key is
579 then generated, encrypted with the public key of the X.509 certificate, and stored as part of the
580 user record. At login time it is decrypted with the PKCS#11 module and then used to unlock the
581 account and associated resources. See below for an example how to set up authentication with a
582 security token.</para>
583
584 <para>Instead of a valid PKCS#11 URI, the special strings <literal>list</literal> and
585 <literal>auto</literal> may be specified. If <literal>list</literal> is passed, a brief table of
586 suitable, currently plugged in PKCS#11 hardware tokens is shown, along with their URIs. If
587 <literal>auto</literal> is passed, a suitable PKCS#11 hardware token is automatically selected (this
588 operation will fail if there isn't exactly one suitable token discovered). The latter is a useful
589 shortcut for the most common case where a single PKCS#11 hardware token is plugged in.</para>
590
591 <para>Note that many hardware security tokens implement both PKCS#11/PIV and FIDO2 with the
592 <literal>hmac-secret</literal> extension (for example: the YubiKey 5 series), as supported with the
593 <option>--fido2-device=</option> option below. Both mechanisms are similarly powerful, though FIDO2
594 is the more modern technology. PKCS#11/PIV tokens have the benefit of being recognizable before
595 authentication and hence can be used for implying the user identity to use for logging in, which
596 FIDO2 does not allow. PKCS#11/PIV devices generally require initialization (i.e. storing a
597 private/public key pair on them, see example below) before they can be used; FIDO2 security tokens
598 generally do not required that, and work out of the box.</para>
599
600 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
601 </varlistentry>
602
603 <varlistentry>
604 <term><option>--fido2-credential-algorithm=<replaceable>STRING</replaceable></option></term>
605 <listitem><para>Specify COSE algorithm used in credential generation. The default value is
606 <literal>es256</literal>. Supported values are <literal>es256</literal>, <literal>rs256</literal>
607 and <literal>eddsa</literal>.</para>
608
609 <para><literal>es256</literal> denotes ECDSA over NIST P-256 with SHA-256. <literal>rs256</literal>
610 denotes 2048-bit RSA with PKCS#1.5 padding and SHA-256. <literal>eddsa</literal> denotes
611 EDDSA over Curve25519 with SHA-512.</para>
612
613 <para>Note that your authenticator may choose not to support some algorithms.</para>
614
615 <xi:include href="version-info.xml" xpointer="v251"/></listitem>
616 </varlistentry>
617
618 <varlistentry>
619 <term><option>--fido2-device=<replaceable>PATH</replaceable></option></term>
620
621 <listitem><para>Takes a path to a Linux <literal>hidraw</literal> device
622 (e.g. <filename>/dev/hidraw1</filename>), referring to a FIDO2 security token implementing the
623 <literal>hmac-secret</literal> extension that shall be able to unlock the user account. A random salt
624 value is generated on the host and passed to the FIDO2 device, which calculates a HMAC hash of the
625 salt using an internal secret key. The result is then used as the key to unlock the user account. The
626 random salt is included in the user record, so that whenever authentication is needed it can be
627 passed to the FIDO2 token again.</para>
628
629 <para>Instead of a valid path to a FIDO2 <literal>hidraw</literal> device the special strings
630 <literal>list</literal> and <literal>auto</literal> may be specified. If <literal>list</literal> is
631 passed, a brief table of suitable discovered FIDO2 devices is shown. If <literal>auto</literal> is
632 passed, a suitable FIDO2 token is automatically selected, if exactly one is discovered. The latter is
633 a useful shortcut for the most common case where a single FIDO2 hardware token is plugged in.</para>
634
635 <para>Note that FIDO2 devices suitable for this option must implement the
636 <literal>hmac-secret</literal> extension. Most current devices (such as the YubiKey 5 series) do. If
637 the extension is not implemented the device cannot be used for unlocking home directories.</para>
638
639 <para>The FIDO2 device may be subsequently removed by setting the device path to an empty string
640 (e.g. <command>homectl update $USER --fido2-device=""</command>).</para>
641
642 <para>Note that many hardware security tokens implement both FIDO2 and PKCS#11/PIV (and thus may be
643 used with either <option>--fido2-device=</option> or <option>--pkcs11-token-uri=</option>), for a
644 discussion see above.</para>
645
646 <xi:include href="version-info.xml" xpointer="v246"/></listitem>
647 </varlistentry>
648
649 <varlistentry>
650 <term><option>--fido2-with-client-pin=<replaceable>BOOL</replaceable></option></term>
651
652 <listitem><para>When enrolling a FIDO2 security token, controls whether to require the user to enter
653 a PIN when unlocking the account (the FIDO2 <literal>clientPin</literal> feature). Defaults to
654 <literal>yes</literal>. (Note: this setting is without effect if the security token does not support
655 the <literal>clientPin</literal> feature at all, or does not allow enabling or disabling
656 it.)</para>
657
658 <xi:include href="version-info.xml" xpointer="v249"/></listitem>
659 </varlistentry>
660
661 <varlistentry>
662 <term><option>--fido2-with-user-presence=<replaceable>BOOL</replaceable></option></term>
663
664 <listitem><para>When enrolling a FIDO2 security token, controls whether to require the user to
665 verify presence (tap the token, the FIDO2 <literal>up</literal> feature) when unlocking the account.
666 Defaults to <literal>yes</literal>. (Note: this setting is without effect if the security token does not support
667 the <literal>up</literal> feature at all, or does not allow enabling or disabling it.)
668 </para>
669
670 <xi:include href="version-info.xml" xpointer="v249"/></listitem>
671 </varlistentry>
672
673 <varlistentry>
674 <term><option>--fido2-with-user-verification=<replaceable>BOOL</replaceable></option></term>
675
676 <listitem><para>When enrolling a FIDO2 security token, controls whether to require user verification
677 when unlocking the account (the FIDO2 <literal>uv</literal> feature). Defaults to
678 <literal>no</literal>. (Note: this setting is without effect if the security token does not support
679 the <literal>uv</literal> feature at all, or does not allow enabling or disabling it.)</para>
680
681 <xi:include href="version-info.xml" xpointer="v249"/></listitem>
682 </varlistentry>
683
684 <varlistentry>
685 <term><option>--recovery-key=<replaceable>BOOL</replaceable></option></term>
686
687 <listitem><para>Accepts a boolean argument. If enabled a recovery key is configured for the
688 account. A recovery key is a computer generated access key that may be used to regain access to an
689 account if the password has been forgotten or the authentication token lost. The key is generated and
690 shown on screen, and should be printed or otherwise transferred to a secure location. A recovery key
691 may be entered instead of a regular password to unlock the account.</para>
692
693 <xi:include href="version-info.xml" xpointer="v247"/></listitem>
694 </varlistentry>
695 </variablelist>
696 </refsect1>
697
698 <refsect1>
699 <title>Blob Directory User Record Properties</title>
700 <variablelist>
701 <varlistentry>
702 <term><option>--blob=<replaceable>PATH</replaceable></option></term>
703 <term><option>-b</option> <replaceable>PATH</replaceable></term>
704 <term><option>--blob=<replaceable>FILENAME</replaceable>=<replaceable>PATH</replaceable></option></term>
705 <term><option>-b</option> <replaceable>FILENAME</replaceable>=<replaceable>PATH</replaceable></term>
706
707 <listitem><para>Accepts either a directory path, or a file name followed by a file path. If just a
708 directory path is specified, then the user's entire blob directory is replaced the specified path.
709 Note that this replacement is performed before per-file manipulations are applied, which means these per-file
710 manipulations will be applied on top of the specified directory. If a filename and file path are specified, then
711 the single specified blob file will be overwritten with the specified path. If completely blank, the entire blob
712 directory is emptied out (which also resets all previous blob-related flags up to this point). If a filename is
713 specified but the corresponding path is blank, that single file will be deleted from the blob directory. All changes
714 are performed in temporary copies of the specified files in directories, which means that the originals specified on
715 the command line are not modified. See <ulink url="https://systemd.io/USER_RECORD_BLOB_DIRS">User Record Blob Directories</ulink>
716 for more information about blob directories.</para>
717
718 <xi:include href="version-info.xml" xpointer="v256"/></listitem>
719 </varlistentry>
720
721 <varlistentry>
722 <term><option>--avatar=<replaceable>PATH</replaceable></option></term>
723 <term><option>--login-background=<replaceable>PATH</replaceable></option></term>
724
725 <listitem><para>Accept a file path. If set, the specified file is used to overwrite the
726 corresponding file in the user's blob directory. If blank, the corresponding file is deleted
727 from the blob directory. Essentially, these options are shortcuts to
728 <option>--blob=<replaceable>FILENAME</replaceable>=<replaceable>PATH</replaceable></option>
729 for the known filenames defined in
730 <ulink url="https://systemd.io/USER_RECORD_BLOB_DIRS">User Record Blob Directories</ulink>.</para>
731
732 <xi:include href="version-info.xml" xpointer="v256"/></listitem>
733 </varlistentry>
734 </variablelist>
735 </refsect1>
736
737 <refsect1>
738 <title>Account Management User Record Properties</title>
739 <variablelist>
740 <varlistentry>
741 <term><option>--locked=<replaceable>BOOLEAN</replaceable></option></term>
742
743 <listitem><para>Takes a boolean argument. Specifies whether this user account shall be locked. If
744 true logins into this account are prohibited, if false (the default) they are permitted (of course,
745 only if authorization otherwise succeeds).</para>
746
747 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
748 </varlistentry>
749
750 <varlistentry>
751 <term><option>--not-before=<replaceable>TIMESTAMP</replaceable></option></term>
752 <term><option>--not-after=<replaceable>TIMESTAMP</replaceable></option></term>
753
754 <listitem><para>These options take a timestamp string, in the format documented in
755 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry> and
756 configures points in time before and after logins into this account are not
757 permitted.</para>
758
759 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
760 </varlistentry>
761
762 <varlistentry>
763 <term><option>--rate-limit-interval=<replaceable>SECS</replaceable></option></term>
764 <term><option>--rate-limit-burst=<replaceable>NUMBER</replaceable></option></term>
765
766 <listitem><para>Configures a rate limit on authentication attempts for this user. If the user
767 attempts to authenticate more often than the specified number, on a specific system, within the
768 specified time interval authentication is refused until the time interval passes. Defaults to 10
769 times per 1min.</para>
770
771 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
772 </varlistentry>
773
774 <varlistentry>
775 <term><option>--password-hint=<replaceable>TEXT</replaceable></option></term>
776
777 <listitem><para>Takes a password hint to store alongside the user record. This string is stored
778 accessible only to privileged users and the user itself and may not be queried by other users.
779 Example: <option>--password-hint="My first pet's name"</option>.</para>
780
781 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
782 </varlistentry>
783
784 <varlistentry>
785 <term><option>--enforce-password-policy=<replaceable>BOOL</replaceable></option></term>
786 <term><option>-P</option></term>
787
788 <listitem><para>Takes a boolean argument. Configures whether to enforce the system's password policy
789 for this user, regarding quality and strength of selected passwords. Defaults to
790 on. <option>-P</option> is short for
791 <option>--enforce-password-policy=no</option>.</para>
792
793 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
794 </varlistentry>
795
796 <varlistentry>
797 <term><option>--password-change-now=<replaceable>BOOL</replaceable></option></term>
798
799 <listitem><para>Takes a boolean argument. If true the user is asked to change their password on next
800 login.</para>
801
802 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
803 </varlistentry>
804
805 <varlistentry>
806 <term><option>--password-change-min=<replaceable>TIME</replaceable></option></term>
807 <term><option>--password-change-max=<replaceable>TIME</replaceable></option></term>
808 <term><option>--password-change-warn=<replaceable>TIME</replaceable></option></term>
809 <term><option>--password-change-inactive=<replaceable>TIME</replaceable></option></term>
810
811 <listitem><para>Each of these options takes a time span specification as argument (in the syntax
812 documented in
813 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>) and
814 configures various aspects of the user's password expiration policy. Specifically,
815 <option>--password-change-min=</option> configures how much time has to pass after changing the
816 password of the user until the password may be changed again. If the user tries to change their
817 password before this time passes the attempt is refused. <option>--password-change-max=</option>
818 configures how soon after it has been changed the password expires and needs to be changed again.
819 After this time passes logging in may only proceed after the password is changed.
820 <option>--password-change-warn=</option> specifies how much earlier than then the time configured
821 with <option>--password-change-max=</option> the user is warned at login to change their password as
822 it will expire soon. Finally, <option>--password-change-inactive=</option> configures the time which
823 has to pass after the password as expired until the user is not permitted to log in or change the
824 password anymore. Note that these options only apply to password authentication, and do not apply to
825 other forms of authentication, for example PKCS#11-based security token
826 authentication.</para>
827
828 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
829 </varlistentry>
830 </variablelist>
831 </refsect1>
832
833 <refsect1>
834 <title>Resource Management User Record Properties</title>
835 <variablelist>
836 <varlistentry>
837 <term><option>--disk-size=<replaceable>BYTES</replaceable></option></term>
838 <listitem><para>Either takes a size in bytes as argument (possibly using the usual K, M, G, …
839 suffixes for 1024 base values), a percentage value, or the special strings <literal>min</literal> or
840 <literal>max</literal>, and configures the disk space to assign to the user. If a percentage value is
841 specified (i.e. the argument suffixed with <literal>%</literal>) it is taken relative to the
842 available disk space of the backing file system. If specified as <literal>min</literal> assigns the
843 minimal disk space permitted by the constraints of the backing file system and other limits, when
844 specified as <literal>max</literal> assigns the maximum disk space available. If the LUKS2 backend is
845 used this configures the size of the loopback file and file system contained therein. For the other
846 storage backends configures disk quota using the filesystem's native quota logic, if available. If
847 not specified, defaults to 85% of the available disk space for the LUKS2 backend and to no quota for
848 the others.</para>
849
850 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
851 </varlistentry>
852
853 <varlistentry>
854 <term><option>--nice=<replaceable>NICE</replaceable></option></term>
855
856 <listitem><para>Takes the numeric scheduling priority ("nice level") to apply to the processes of the user at login
857 time. Takes a numeric value in the range -20 (highest priority) to 19 (lowest priority).</para>
858
859 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
860 </varlistentry>
861
862 <varlistentry>
863 <term><option>--rlimit=<replaceable>LIMIT</replaceable>=<replaceable>VALUE</replaceable><optional>:<replaceable>VALUE</replaceable></optional></option></term>
864
865 <listitem><para>Allows configuration of resource limits for processes of this user, see <citerefentry
866 project='man-pages'><refentrytitle>getrlimit</refentrytitle><manvolnum>2</manvolnum></citerefentry>
867 for details. Takes a resource limit name (e.g. <literal>LIMIT_NOFILE</literal>) followed by an equal
868 sign, followed by a numeric limit. Optionally, separated by colon a second numeric limit may be
869 specified. If two are specified this refers to the soft and hard limits, respectively. If only one
870 limit is specified the setting sets both limits in one.</para>
871
872 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
873 </varlistentry>
874
875 <varlistentry>
876 <term><option>--tasks-max=<replaceable>TASKS</replaceable></option></term>
877
878 <listitem><para>Takes a non-zero unsigned integer as argument. Configures the maximum number of tasks
879 (i.e. threads, where each process is at least one thread) the user may have at any given time. This
880 limit applies to all tasks forked off the user's sessions, even if they change user identity via
881 <citerefentry project='man-pages'><refentrytitle>su</refentrytitle><manvolnum>1</manvolnum></citerefentry>
882 or a similar tool. Use <option>--rlimit=LIMIT_NPROC=</option> to place a limit on the tasks actually
883 running under the UID of the user, thus excluding any child processes that might have changed user
884 identity. This controls the <varname>TasksMax=</varname> setting of the per-user systemd slice unit
885 <filename>user-$UID.slice</filename>. See
886 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>
887 for further details.</para>
888
889 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
890 </varlistentry>
891
892 <varlistentry>
893 <term><option>--memory-high=<replaceable>BYTES</replaceable></option></term>
894 <term><option>--memory-max=<replaceable>BYTES</replaceable></option></term>
895
896 <listitem><para>Set a limit on the memory a user may take up on a system at any given time in bytes
897 (the usual K, M, G, … suffixes are supported, to the base of 1024). This includes all memory used by
898 the user itself and all processes they forked off that changed user credentials. This controls the
899 <varname>MemoryHigh=</varname> and <varname>MemoryMax=</varname> settings of the per-user systemd
900 slice unit <filename>user-$UID.slice</filename>. See
901 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>
902 for further details.</para>
903
904 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
905 </varlistentry>
906
907 <varlistentry>
908 <term><option>--cpu-weight=<replaceable>WEIGHT</replaceable></option></term>
909 <term><option>--io-weight=<replaceable>WEIGHT</replaceable></option></term>
910
911 <listitem><para>Set CPU and IO scheduling weights of the processes of the user, including those of
912 processes forked off by the user that changed user credentials. Takes a numeric value in the range
913 1…10000. This controls the <varname>CPUWeight=</varname> and <varname>IOWeight=</varname> settings of
914 the per-user systemd slice unit <filename>user-$UID.slice</filename>. See
915 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>
916 for further details.</para>
917
918 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
919 </varlistentry>
920 </variablelist>
921 </refsect1>
922
923 <refsect1>
924 <title>Storage User Record Properties</title>
925 <variablelist>
926 <varlistentry>
927 <term><option>--tmp-limit=<replaceable>BYTES</replaceable></option></term>
928 <term><option>--tmp-limit=<replaceable>PERCENT</replaceable></option></term>
929 <term><option>--dev-shm-limit=<replaceable>BYTES</replaceable></option></term>
930 <term><option>--dev-shm-limit=<replaceable>PERCENT</replaceable></option></term>
931
932 <listitem><para>Controls the per-user quota on <filename>/tmp/</filename> and
933 <filename>/dev/shm/</filename> that is applied when the user logs in. Takes either an absolute value
934 in bytes (with the usual K, M, G, T suffixes to the base of 1024), or a percentage. In the latter
935 case the limit is applied relative to the size of the respective file system. This limit is only
936 applied if the relevant file system is <literal>tmpfs</literal> and has no effect otherwise. Note
937 that if these options are not used, a default quota might still be enforced (typically 80%.)</para>
938
939 <xi:include href="version-info.xml" xpointer="v258"/></listitem>
940 </varlistentry>
941
942 <varlistentry>
943 <term><option>--storage=<replaceable>STORAGE</replaceable></option></term>
944
945 <listitem><para>Selects the storage mechanism to use for this home directory. Takes one of
946 <literal>luks</literal>, <literal>fscrypt</literal>, <literal>directory</literal>,
947 <literal>subvolume</literal>, <literal>cifs</literal>. For details about these mechanisms, see
948 above. If a new home directory is created and the storage type is not specifically specified,
949 <citerefentry><refentrytitle>homed.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
950 defines which default storage to use.</para>
951
952 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
953 </varlistentry>
954
955 <varlistentry>
956 <term><option>--image-path=<replaceable>PATH</replaceable></option></term>
957
958 <listitem><para>Takes a file system path. Configures where to place the user's home directory. When
959 LUKS2 storage is used refers to the path to the loopback file, otherwise to the path to the home
960 directory (which may be in <filename>/home/</filename> or any other accessible filesystem). When
961 unspecified defaults to <filename>/home/$USER.home</filename> when LUKS storage is used and
962 <filename>/home/$USER.homedir</filename> for the other storage mechanisms. Not defined for the
963 <literal>cifs</literal> storage mechanism. To use LUKS2 storage on a regular block device (for
964 example a USB stick) pass the path to the block device here. Specifying the path to a directory here
965 when using LUKS2 storage is not allowed. Similar, specifying the path to a regular file or device
966 node is not allowed if any of the other storage backends are used.</para>
967
968 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
969 </varlistentry>
970
971 <varlistentry>
972 <term><option>--drop-caches=<replaceable>BOOL</replaceable></option></term>
973
974 <listitem><para>Automatically flush OS file system caches on logout. This is useful in combination
975 with the fscrypt storage backend to ensure the OS does not keep decrypted versions of the files and
976 directories in memory (and accessible) after logout. This option is also supported on other backends,
977 but should not bring any benefit there. Defaults to off, except if the selected storage backend is
978 fscrypt, where it defaults to on. Note that flushing OS caches will negatively influence performance
979 of the OS shortly after logout.</para>
980
981 <xi:include href="version-info.xml" xpointer="v250"/></listitem>
982 </varlistentry>
983 </variablelist>
984 </refsect1>
985
986 <refsect1>
987 <title>LUKS Storage User Record Properties</title>
988 <variablelist>
989 <varlistentry>
990 <term><option>--fs-type=<replaceable>TYPE</replaceable></option></term>
991
992 <listitem><para>When LUKS2 storage is used configures the file system type to use inside the home
993 directory LUKS2 container. One of <literal>btrfs</literal>, <literal>ext4</literal>,
994 <literal>xfs</literal>. If not specified
995 <citerefentry><refentrytitle>homed.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
996 defines which default file system type to use. Note that <literal>xfs</literal> is not recommended as
997 its support for file system resizing is too limited.</para>
998
999 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
1000 </varlistentry>
1001
1002 <varlistentry>
1003 <term><option>--luks-discard=<replaceable>BOOL</replaceable></option></term>
1004
1005 <listitem><para>When LUKS2 storage is used configures whether to enable the
1006 <literal>discard</literal> feature of the file system. If enabled the file system on top of the LUKS2
1007 volume will report empty block information to LUKS2 and the loopback file below, ensuring that empty
1008 space in the home directory is returned to the backing file system below the LUKS2 volume, resulting
1009 in a "sparse" loopback file. This option mostly defaults to off, since this permits over-committing
1010 home directories which results in I/O errors if the underlying file system runs full while the upper
1011 file system wants to allocate a block. Such I/O errors are generally not handled well by file systems
1012 nor applications. When LUKS2 storage is used on top of regular block devices (instead of on top a
1013 loopback file) the discard logic defaults to on.</para>
1014
1015 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
1016 </varlistentry>
1017
1018 <varlistentry>
1019 <term><option>--luks-offline-discard=<replaceable>BOOL</replaceable></option></term>
1020
1021 <listitem><para>Similar to <option>--luks-discard=</option>, controls the trimming of the file
1022 system. However, while <option>--luks-discard=</option> controls what happens when the home directory
1023 is active, <option>--luks-offline-discard=</option> controls what happens when it becomes inactive,
1024 i.e. whether to trim/allocate the storage when deactivating the home directory. This option defaults
1025 to on, to ensure disk space is minimized while a user is not logged in.</para>
1026
1027 <xi:include href="version-info.xml" xpointer="v246"/></listitem>
1028 </varlistentry>
1029
1030 <varlistentry>
1031 <term><option>--luks-extra-mount-options=<replaceable>OPTIONS</replaceable></option></term>
1032
1033 <listitem><para>Takes a string containing additional mount options to use when mounting the LUKS
1034 volume. If specified, this string will be appended to the default, built-in mount
1035 options. Defaults to "compress=zstd:1,noacl,user_subvol_rm_allowed".</para>
1036
1037 <xi:include href="version-info.xml" xpointer="v250"/></listitem>
1038 </varlistentry>
1039
1040 <varlistentry>
1041 <term><option>--luks-cipher=<replaceable>CIPHER</replaceable></option></term>
1042 <term><option>--luks-cipher-mode=<replaceable>MODE</replaceable></option></term>
1043 <term><option>--luks-volume-key-size=<replaceable>BYTES</replaceable></option></term>
1044 <term><option>--luks-pbkdf-type=<replaceable>TYPE</replaceable></option></term>
1045 <term><option>--luks-pbkdf-hash-algorithm=<replaceable>ALGORITHM</replaceable></option></term>
1046 <term><option>--luks-pbkdf-force-iterations=<replaceable>ITERATIONS</replaceable></option></term>
1047 <term><option>--luks-pbkdf-time-cost=<replaceable>SECONDS</replaceable></option></term>
1048 <term><option>--luks-pbkdf-memory-cost=<replaceable>BYTES</replaceable></option></term>
1049 <term><option>--luks-pbkdf-parallel-threads=<replaceable>THREADS</replaceable></option></term>
1050 <term><option>--luks-sector-size=<replaceable>BYTES</replaceable></option></term>
1051
1052 <listitem><para>Configures various cryptographic parameters for the LUKS2 storage mechanism. See
1053 <citerefentry
1054 project='man-pages'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>
1055 for details on the specific attributes.</para>
1056
1057 <para>Note that <command>homectl</command> uses bytes for key size, like
1058 <filename>/proc/crypto</filename>, but <citerefentry
1059 project='man-pages'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry>
1060 uses bits.</para>
1061
1062 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
1063 </varlistentry>
1064
1065 <varlistentry>
1066 <term><option>--auto-resize-mode=</option></term>
1067
1068 <listitem><para>Configures whether to automatically grow and/or shrink the backing file system on
1069 login and logout. Takes one of the strings <literal>off</literal>, <literal>grow</literal>,
1070 <literal>shrink-and-grow</literal>. Only applies to the LUKS2 backend currently, and if the btrfs
1071 file system is used inside it (since only then online growing/shrinking of the file system is
1072 supported). Defaults to <literal>shrink-and-grow</literal>, if LUKS2/btrfs is used, otherwise is
1073 off. If set to <literal>off</literal> no automatic shrinking/growing during login or logout is
1074 done. If set to <literal>grow</literal> the home area is grown to the size configured via
1075 <option>--disk-size=</option> should it currently be smaller. If it already matches the configured
1076 size or is larger no operation is executed. If set to <literal>shrink-and-grow</literal> the home
1077 area is also resized during logout to the minimal size the used disk space and file system
1078 constraints permit. This mode thus ensures that while a home area is activated it is sized to the
1079 configured size, but while deactivated it is compacted taking up only the minimal space possible.
1080 Note that if the system is powered off abnormally or if the user otherwise not logged out cleanly the
1081 shrinking operation will not take place, and the user has to re-login/logout again before it is
1082 executed again.</para>
1083
1084 <xi:include href="version-info.xml" xpointer="v250"/></listitem>
1085 </varlistentry>
1086
1087 <varlistentry>
1088 <term><option>--rebalance-weight=</option></term>
1089
1090 <listitem><para>Configures the weight parameter for the free disk space rebalancing logic. Only
1091 applies to the LUKS2 backend (since for the LUKS2 backend disk space is allocated from a per-user
1092 loopback file system instead of immediately from a common pool like the other backends do it). In
1093 regular intervals free disk space in the active home areas and their backing storage is redistributed
1094 among them, taking the weight value configured here into account. Expects an integer in the range
1095 1…10000, or the special string <literal>off</literal>. If not specified, defaults to 100. The weight
1096 is used to scale free space made available to the home areas: a home area with a weight of 200 will
1097 get twice the free space as one with a weight of 100; a home area with a weight of 50 will get half
1098 of that. The backing file system will be assigned space for a weight of 20. If set to
1099 <literal>off</literal> no automatic free space distribution is done for this home area. Note that
1100 resizing the home area explicitly (with <command>homectl resize</command> see below) will implicitly
1101 turn off the automatic rebalancing. To reenable the automatic rebalancing use
1102 <option>--rebalance-weight=</option> with an empty parameter.</para>
1103
1104 <xi:include href="version-info.xml" xpointer="v250"/></listitem>
1105 </varlistentry>
1106 </variablelist>
1107 </refsect1>
1108
1109 <refsect1>
1110 <title>Mounting User Record Properties</title>
1111 <variablelist>
1112 <varlistentry>
1113 <term><option>--nosuid=<replaceable>BOOL</replaceable></option></term>
1114 <term><option>--nodev=<replaceable>BOOL</replaceable></option></term>
1115 <term><option>--noexec=<replaceable>BOOL</replaceable></option></term>
1116
1117 <listitem><para>Configures the <literal>nosuid</literal>, <literal>nodev</literal> and
1118 <literal>noexec</literal> mount options for the home directories. By default, <literal>nodev</literal>
1119 and <literal>nosuid</literal> are on, while <literal>noexec</literal> is off. For details about these
1120 mount options see <citerefentry
1121 project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
1122
1123 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
1124 </varlistentry>
1125 </variablelist>
1126 </refsect1>
1127
1128 <refsect1>
1129 <title>CIFS User Record Properties</title>
1130 <variablelist>
1131 <varlistentry>
1132 <term><option>--cifs-domain=<replaceable>DOMAIN</replaceable></option></term>
1133 <term><option>--cifs-user-name=<replaceable>USER</replaceable></option></term>
1134 <term><option>--cifs-service=<replaceable>SERVICE</replaceable></option></term>
1135 <term><option>--cifs-extra-mount-options=<replaceable>OPTIONS</replaceable></option></term>
1136
1137 <listitem><para>Configures the Windows File Sharing (CIFS) domain and user to associate with the home
1138 directory/user account, as well as the file share ("service") to mount as directory. The latter is
1139 used when <literal>cifs</literal> storage is selected. The file share should be specified in format
1140 <literal>//<replaceable>host</replaceable>/<replaceable>share</replaceable>/<replaceable>directory/…</replaceable></literal>. The
1141 directory part is optional — if not specified, the home directory will be placed in the top-level
1142 directory of the share. The <option>--cifs-extra-mount-options=</option> setting allows specifying
1143 additional mount options when mounting the share, see <citerefentry
1144 project='man-pages'><refentrytitle>mount.cifs</refentrytitle><manvolnum>8</manvolnum></citerefentry>
1145 for details.</para>
1146
1147 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
1148 </varlistentry>
1149 </variablelist>
1150 </refsect1>
1151
1152 <refsect1>
1153 <title>Login Behaviour Record Properties</title>
1154 <variablelist>
1155 <varlistentry>
1156 <term><option>--stop-delay=<replaceable>SECS</replaceable></option></term>
1157
1158 <listitem><para>Configures the time the per-user service manager shall continue to run after the all
1159 sessions of the user ended. The default is configured in
1160 <citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry> (for
1161 home directories of LUKS2 storage located on removable media this defaults to 0 though). A longer
1162 time makes sure quick, repetitive logins are more efficient as the user's service manager does not
1163 have to be started every time.</para>
1164
1165 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
1166 </varlistentry>
1167
1168 <varlistentry>
1169 <term><option>--kill-processes=<replaceable>BOOL</replaceable></option></term>
1170
1171 <listitem><para>Configures whether to kill all processes of the user on logout. The default is
1172 configured in
1173 <citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
1174
1175 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
1176 </varlistentry>
1177
1178 <varlistentry>
1179 <term><option>--auto-login=<replaceable>BOOL</replaceable></option></term>
1180
1181 <listitem><para>Takes a boolean argument. Configures whether the graphical UI of the system should
1182 automatically log this user in if possible. Defaults to off. If less or more than one user is marked
1183 this way automatic login is disabled.</para>
1184
1185 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
1186 </varlistentry>
1187
1188 <varlistentry>
1189 <term><option>--session-launcher=<replaceable>LAUNCHER</replaceable></option></term>
1190
1191 <listitem><para>Takes a string argument. Configures the user's preferred session launcher
1192 .desktop entry file (i.e. <literal>gnome</literal>, <literal>plasma</literal>, or other names that
1193 appear in <filename>/usr/share/xesssions/</filename> or <filename>/usr/share/wayland-sessions</filename>).
1194 This is read by the display manager to pick the default session that is launched when the user logs in.</para>
1195
1196 <xi:include href="version-info.xml" xpointer="v256"/></listitem>
1197 </varlistentry>
1198
1199 <varlistentry>
1200 <term><option>--session-type=<replaceable>TYPE</replaceable></option></term>
1201
1202 <listitem><para>Takes a string argument. Configures the user's preferred session type
1203 (i.e. <literal>x11</literal>, <literal>wayland</literal>, and other values accepted by
1204 <varname>$XDG_SESSION_TYPE</varname>). This is read by the display manage to pick the
1205 default session type the user is logged into.</para>
1206
1207 <xi:include href="version-info.xml" xpointer="v256"/></listitem>
1208 </varlistentry>
1209 </variablelist>
1210 </refsect1>
1211
1212 <refsect1>
1213 <title>Commands</title>
1214
1215 <para>The following commands are understood:</para>
1216
1217 <variablelist>
1218
1219 <varlistentry>
1220 <term><command>list</command></term>
1221
1222 <listitem><para>List all home directories (along with brief details) currently managed by
1223 <filename>systemd-homed.service</filename>. This command is also executed if none is specified on the
1224 command line. (Note that the list of users shown by this command does not include users managed by
1225 other subsystems, such as system users or any traditional users listed in
1226 <filename>/etc/passwd</filename>.)</para>
1227
1228 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
1229 </varlistentry>
1230
1231 <varlistentry>
1232 <term><command>activate</command> <replaceable>USER</replaceable> [<replaceable>USER…</replaceable>]</term>
1233
1234 <listitem><para>Activate one or more home directories. The home directories of each listed user will
1235 be activated and made available under their mount points (typically in
1236 <filename>/home/$USER</filename>). Note that any home activated this way stays active indefinitely,
1237 until it is explicitly deactivated again (with <command>deactivate</command>, see below), or the user
1238 logs in and out again and it thus is deactivated due to the automatic deactivation-on-logout
1239 logic.</para>
1240
1241 <para>Activation of a home directory involves various operations that depend on the selected storage
1242 mechanism. If the LUKS2 mechanism is used, this generally involves: inquiring the user for a
1243 password, setting up a loopback device, validating and activating the LUKS2 volume, checking the file
1244 system, mounting the file system, and potentially changing the ownership of all included files to the
1245 correct UID/GID.</para>
1246
1247 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
1248 </varlistentry>
1249
1250 <varlistentry>
1251 <term><command>deactivate</command> <replaceable>USER</replaceable> [<replaceable>USER…</replaceable>]</term>
1252
1253 <listitem><para>Deactivate one or more home directories. This undoes the effect of
1254 <command>activate</command>.</para>
1255
1256 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
1257 </varlistentry>
1258
1259 <varlistentry>
1260 <term><command>inspect</command> <replaceable>USER</replaceable> [<replaceable>USER…</replaceable>]</term>
1261
1262 <listitem><para>Show various details about the specified home directories. This shows various
1263 information about the home directory and its user account, including runtime data such as current
1264 state, disk use and similar. Combine with <option>--json=</option> to show the detailed JSON user
1265 record instead, possibly combined with <option>--export-format=</option> to suppress certain aspects
1266 of the output.</para>
1267
1268 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
1269 </varlistentry>
1270
1271 <varlistentry>
1272 <term><command>authenticate</command> <replaceable>USER</replaceable> [<replaceable>USER…</replaceable>]</term>
1273
1274 <listitem><para>Validate authentication credentials of a home directory. This queries the caller for
1275 a password (or similar) and checks that it correctly unlocks the home directory. This leaves the home
1276 directory in the state it is in, i.e. it leaves the home directory in inactive state if it was
1277 inactive before, and in active state if it was active before.</para>
1278
1279 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
1280 </varlistentry>
1281
1282 <varlistentry>
1283 <term><command>create</command> <replaceable>USER</replaceable></term>
1284 <term><command>create</command> <option>--identity=<replaceable>PATH</replaceable></option> <optional><replaceable>USER</replaceable></optional></term>
1285
1286 <listitem><para>Create a new home directory/user account of the specified name. Use the various
1287 user record property options (as documented above) to control various aspects of the home directory
1288 and its user accounts.</para>
1289
1290 <para>The specified user name should follow the strict syntax described on <ulink
1291 url="https://systemd.io/USER_NAMES">User/Group Name Syntax</ulink>.</para>
1292
1293 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
1294 </varlistentry>
1295
1296 <varlistentry>
1297 <term><command>adopt</command> <replaceable>PATH</replaceable> [<replaceable>PATH</replaceable>…]</term>
1298
1299 <listitem><para>Adopts one or more existing home directories on the local system. Takes one or more paths to
1300 <filename>*.home</filename> LUKS home directories or <filename>*.homedir/</filename> standalone home
1301 directories or subvolumes previously created by <filename>systemd-homed</filename> and makes them
1302 available locally for login. The referenced files are not moved. This is an alternative for moving
1303 such home directories into <filename>/home/</filename> (where they would be picked up
1304 automatically).</para>
1305
1306 <xi:include href="version-info.xml" xpointer="v258"/></listitem>
1307 </varlistentry>
1308
1309 <varlistentry>
1310 <term><command>register</command> <replaceable>FILE</replaceable> [<replaceable>FILE</replaceable>…]</term>
1311
1312 <listitem><para>Registers one or more users, without creating their home directories. Takes one or
1313 more paths to JSON user record files. If the path is specified as <literal>-</literal> reads the
1314 JSON user record from standard input.</para>
1315
1316 <para>Registering a user makes it accessible on the local system without creating a new home
1317 directory. This is particularly useful for making a user accessible on a system it was not originally
1318 created on.</para>
1319
1320 <para>Here's an example how to make a local user account with its home directory accessible on a
1321 remote system, using SMB/CIFS file sharing. With Samba installed in its default configuration invoke
1322 as <literal>root</literal>:</para>
1323
1324 <programlisting># smbpasswd -a lennart</programlisting>
1325
1326 <para>Continue as regular user <literal>lennart</literal>:</para>
1327
1328 <programlisting>$ homectl update lennart --ssh-authorized-keys=… -N --storage=cifs --cifs-service="//$HOSTNAME/lennart"
1329 $ homectl get-signing-key | ssh targetsystem homectl add-signing-key --key-name="$HOSTNAME".public
1330 $ homectl inspect -E lennart | ssh targetsystem homectl register -
1331 $ ssh lennart@targetsystem</programlisting>
1332
1333 <para>This first ensures the user account <literal>lennart</literal> is known to and accessible by
1334 Samba. It then registers a local SSH access that shall be used for accessing this user, and
1335 configures CIFS as default storage for non-local systems on the account. It then adds the local
1336 system's account signing key to the target system. Then it registers the local user account with the
1337 target system. Finally it logs into the account on the target system. The target system will then
1338 connect back via SMB/CIFS to access the home directory.</para>
1339
1340 <xi:include href="version-info.xml" xpointer="v258"/></listitem>
1341 </varlistentry>
1342
1343 <varlistentry>
1344 <term><command>unregister</command> <replaceable>USER</replaceable>…</term>
1345
1346 <listitem><para>Unregisters one or more user accounts. This only removes the user record from the
1347 local system, it does not delete the home directory. The home directory can be readded via the
1348 <command>register</command> or <command>adopt</command> command later, on this or another
1349 system. Note that unregistering a user whose home directory is placed in <filename>/home/</filename>
1350 will not make the user disappear from the local user database, as all supported home directories
1351 placed there will show up in the user database. However, the user record will become "unfixated",
1352 i.e. lose its binding to the local system. When logged into it will automatically regain the binding,
1353 and acquire a local UID/GID pair.</para>
1354
1355 <xi:include href="version-info.xml" xpointer="v258"/></listitem>
1356 </varlistentry>
1357
1358 <varlistentry>
1359 <term><command>remove</command> <replaceable>USER</replaceable></term>
1360
1361 <listitem><para>Remove a home directory/user account. This will remove both the home directory's user
1362 record and the home directory itself, and thus delete all files and directories owned by the
1363 user.</para>
1364
1365 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
1366 </varlistentry>
1367
1368 <varlistentry>
1369 <term><command>update</command> <replaceable>USER</replaceable></term>
1370 <term><command>update</command> <option>--identity=<replaceable>PATH</replaceable></option> <optional><replaceable>USER</replaceable></optional></term>
1371
1372 <listitem><para>Update a home directory/user account. Use the various user record property options
1373 (as documented above) to make changes to the account, or alternatively provide a full, updated JSON
1374 user record via the <option>--identity=</option> option.</para>
1375
1376 <para>Note that changes to user records not signed by a cryptographic private key available locally
1377 are not permitted, unless <option>--identity=</option> is used with a user record that is already
1378 correctly signed by a recognized private key.</para>
1379
1380 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
1381 </varlistentry>
1382
1383 <varlistentry>
1384 <term><command>passwd</command> <replaceable>USER</replaceable></term>
1385
1386 <listitem><para>Change the password of the specified home directory/user account.</para>
1387
1388 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
1389 </varlistentry>
1390
1391 <varlistentry>
1392 <term><command>resize</command> <replaceable>USER</replaceable> <replaceable>BYTES</replaceable></term>
1393
1394 <listitem><para>Change the disk space assigned to the specified home directory. If the LUKS2 storage
1395 mechanism is used this will automatically resize the loopback file and the file system contained
1396 within. Note that if <literal>ext4</literal> is used inside of the LUKS2 volume, it is necessary to
1397 deactivate the home directory before shrinking it (i.e the user has to log out). Growing can be done
1398 while the home directory is active. If <literal>xfs</literal> is used inside of the LUKS2 volume the
1399 home directory may not be shrunk whatsoever. On all three of <literal>ext4</literal>,
1400 <literal>xfs</literal> and <literal>btrfs</literal> the home directory may be grown while the user is
1401 logged in, and on the latter also shrunk while the user is logged in. If the
1402 <literal>subvolume</literal>, <literal>directory</literal>, <literal>fscrypt</literal> storage
1403 mechanisms are used, resizing will change file system quota. The size parameter may make use of the
1404 usual suffixes B, K, M, G, T (to the base of 1024). The special strings <literal>min</literal> and
1405 <literal>max</literal> may be specified in place of a numeric size value, for minimizing or
1406 maximizing disk space assigned to the home area, taking constraints of the file system, disk usage inside
1407 the home area and on the backing storage into account.</para>
1408
1409 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
1410 </varlistentry>
1411
1412 <varlistentry>
1413 <term><command>lock</command> <replaceable>USER</replaceable></term>
1414
1415 <listitem><para>Temporarily suspend access to the user's home directory and remove any associated
1416 cryptographic keys from memory. Any attempts to access the user's home directory will stall until the
1417 home directory is unlocked again (i.e. re-authenticated). This functionality is primarily intended to
1418 be used during system suspend to make sure the user's data cannot be accessed until the user
1419 re-authenticates on resume. This operation is only defined for home directories that use the LUKS2
1420 storage mechanism.</para>
1421
1422 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
1423 </varlistentry>
1424
1425 <varlistentry>
1426 <term><command>unlock</command> <replaceable>USER</replaceable></term>
1427
1428 <listitem><para>Resume access to the user's home directory again, undoing the effect of
1429 <command>lock</command> above. This requires authentication of the user, as the cryptographic keys
1430 required for access to the home directory need to be reacquired.</para>
1431
1432 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
1433 </varlistentry>
1434
1435 <varlistentry>
1436 <term><command>lock-all</command></term>
1437
1438 <listitem><para>Execute the <command>lock</command> command on all suitable home directories at
1439 once. This operation is generally executed on system suspend (i.e. by <command>systemctl
1440 suspend</command> and related commands), to ensure all active user's cryptographic keys for accessing
1441 their home directories are removed from memory.</para>
1442
1443 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
1444 </varlistentry>
1445
1446 <varlistentry>
1447 <term><command>deactivate-all</command></term>
1448
1449 <listitem><para>Execute the <command>deactivate</command> command on all active home directories at
1450 once. This operation is generally executed on system shut down (i.e. by <command>systemctl
1451 poweroff</command> and related commands), to ensure all active user's home directories are fully
1452 deactivated before <filename>/home/</filename> and related file systems are unmounted.</para>
1453
1454 <xi:include href="version-info.xml" xpointer="v247"/></listitem>
1455 </varlistentry>
1456
1457 <varlistentry>
1458 <term><command>with</command> <replaceable>USER</replaceable> <replaceable>COMMAND…</replaceable></term>
1459
1460 <listitem><para>Activate the specified user's home directory, run the specified command (under the
1461 caller's identity, not the specified user's) and deactivate the home directory afterwards again
1462 (unless the user is logged in otherwise). This command is useful for running privileged backup
1463 scripts and such, but requires authentication with the user's credentials in order to be able to
1464 unlock the user's home directory.</para>
1465
1466 <xi:include href="version-info.xml" xpointer="v245"/></listitem>
1467 </varlistentry>
1468
1469 <varlistentry>
1470 <term><command>rebalance</command></term>
1471
1472 <listitem><para>Rebalance free disk space between active home areas and the backing storage. See
1473 <option>--rebalance-weight=</option> above. This executes no operation unless there's at least one
1474 active LUKS2 home area that has disk space rebalancing enabled. This operation is synchronous: it
1475 will only complete once disk space is rebalanced according to the rebalancing weights. Note that
1476 rebalancing also takes place automatically in the background in regular intervals. Use this command
1477 to synchronously ensure disk space is properly redistributed before initiating an operation requiring
1478 large amounts of disk space.</para>
1479
1480 <xi:include href="version-info.xml" xpointer="v250"/></listitem>
1481 </varlistentry>
1482
1483 <varlistentry>
1484 <term><command>firstboot</command></term>
1485
1486 <listitem><para>This command is supposed to be invoked during the initial boot of the system. It
1487 checks whether any regular home area exists so far, and if not queries the user interactively on the
1488 console for user name and password and creates one (only if <option>--prompt-new-user</option> is
1489 specified). Alternatively, if one or more service credentials whose name starts with
1490 <literal>home.create.</literal> are passed to the command (containing a user record in JSON format)
1491 these users are automatically created at boot.</para>
1492
1493 <para>This command is invoked by the <filename>systemd-homed-firstboot.service</filename> service
1494 unit.</para>
1495
1496 <xi:include href="version-info.xml" xpointer="v256"/></listitem>
1497 </varlistentry>
1498
1499 <varlistentry>
1500 <term><command>list-signing-keys</command></term>
1501
1502 <listitem><para>Show a list of public keys that home directories can be signed with to be allowed for
1503 local login. One such key (<filename>local.public</filename>) will be generated automatically for
1504 signing locally created home directories, but additional public keys may be registered to accept home
1505 directories from other origins too (see <command>add-signing-key</command> below).</para>
1506
1507 <xi:include href="version-info.xml" xpointer="v258"/></listitem>
1508 </varlistentry>
1509
1510 <varlistentry>
1511 <term><command>get-signing-key</command> [<replaceable>NAME…</replaceable>]</term>
1512
1513 <listitem><para>Write the public key identified by the specified name to standard output (in PEM
1514 format). If no name is specified defaults to <filename>local.public</filename>, i.e. the
1515 automatically generated key for locally created home directories.</para>
1516
1517 <xi:include href="version-info.xml" xpointer="v258"/></listitem>
1518 </varlistentry>
1519
1520 <varlistentry>
1521 <term><command>add-signing-key</command> [<replaceable>FILE…</replaceable>]</term>
1522
1523 <listitem><para>Add public key(s) from the specified PEM key file(s) to the list of keys that home
1524 areas have to be signed by to be permitted for local login. If a path of <literal>-</literal> is
1525 specified, or if no file is specified at all, the key will be read from standard input. The key file
1526 name(s) must carry the <filename>.public</filename> suffix, and the file name(s) will be used to name
1527 the key(s) once added, too. If a key is added from standard input the key name must be specified
1528 explicitly via <option>--key-name=</option>, see above.</para>
1529
1530 <para>This command is useful for permitting local home directories to be used on a remote
1531 system. Example:</para>
1532
1533 <programlisting>homectl get-signing-key | ssh myotherhost homectl add-signing-key --key-name="$HOSTNAME".public</programlisting>
1534
1535 <xi:include href="version-info.xml" xpointer="v258"/></listitem>
1536 </varlistentry>
1537
1538 <varlistentry>
1539 <term><command>remove-signing-key</command> <replaceable>NAME…</replaceable></term>
1540
1541 <listitem><para>Remove the public key identified by the specified name from the list of keys that
1542 control from which origins to permit home directories for login.</para>
1543
1544 <xi:include href="version-info.xml" xpointer="v258"/></listitem>
1545 </varlistentry>
1546
1547 </variablelist>
1548 </refsect1>
1549
1550 <refsect1>
1551 <title>Credentials</title>
1552
1553 <para>When invoked with the <command>firstboot</command> command, <command>homectl</command> supports the
1554 service credentials logic as implemented by
1555 <varname>ImportCredential=</varname>/<varname>LoadCredential=</varname>/<varname>SetCredential=</varname>
1556 (see <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry> for
1557 details). The following credentials are used when passed in:</para>
1558
1559 <variablelist class='system-credentials'>
1560 <varlistentry>
1561 <term><varname>home.create.*</varname></term>
1562
1563 <listitem><para>If one or more credentials whose names begin with <literal>home.create.</literal>,
1564 followed by a valid UNIX username are passed, a new home area is created, one for each specified user
1565 record.</para>
1566
1567 <xi:include href="version-info.xml" xpointer="v256"/></listitem>
1568 </varlistentry>
1569 </variablelist>
1570 </refsect1>
1571
1572 <refsect1>
1573 <title>Kernel Command Line</title>
1574
1575 <variablelist class='kernel-commandline-options'>
1576 <varlistentry>
1577 <term><varname>systemd.firstboot=</varname></term>
1578
1579 <listitem><para>This boolean will disable the effect of <command>homectl firstboot</command>
1580 command. It's primarily interpreted by
1581 <citerefentry><refentrytitle>systemd-firstboot</refentrytitle><manvolnum>1</manvolnum></citerefentry>.</para>
1582
1583 <xi:include href="version-info.xml" xpointer="v256"/></listitem>
1584 </varlistentry>
1585 </variablelist>
1586 </refsect1>
1587
1588 <refsect1>
1589 <title>Exit status</title>
1590
1591 <para>On success, 0 is returned, a non-zero failure code otherwise.</para>
1592
1593 <para>When a command is invoked with <command>with</command>, the exit status of the child is
1594 propagated. Effectively, <command>homectl</command> will exit without error if the command is
1595 successfully invoked <emphasis>and</emphasis> finishes successfully.</para>
1596 </refsect1>
1597
1598 <xi:include href="common-variables.xml" />
1599
1600 <refsect1>
1601 <title>Examples</title>
1602
1603 <example>
1604 <title>Create a user <literal>waldo</literal> in the administrator group <literal>wheel</literal>, and
1605 assign 500 MiB disk space to them.</title>
1606
1607 <programlisting>homectl create waldo --real-name="Waldo McWaldo" -G wheel --disk-size=500M</programlisting>
1608 </example>
1609
1610 <example>
1611 <title>Create a user <literal>wally</literal> on a USB stick, and assign a maximum of 500 concurrent
1612 tasks to them.</title>
1613
1614 <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>
1615 </example>
1616
1617 <example>
1618 <title>Change nice level of user <literal>odlaw</literal> to +5 and make sure the environment variable
1619 <varname>$SOME</varname> is set to the string <literal>THING</literal> for them on login.</title>
1620
1621 <programlisting>homectl update odlaw --nice=5 --setenv=SOME=THING</programlisting>
1622 </example>
1623
1624 <example>
1625 <title>Set up authentication with a YubiKey security token using PKCS#11/PIV:</title>
1626
1627 <programlisting># Clear the Yubikey from any old keys (careful!)
1628 ykman piv reset
1629
1630 # Generate a new private/public key pair on the device, store the public key in 'pubkey.pem'.
1631 ykman piv generate-key -a RSA2048 9d pubkey.pem
1632
1633 # Create a self-signed certificate from this public key, and store it on the device.
1634 ykman piv generate-certificate --subject "Knobelei" 9d pubkey.pem
1635
1636 # We do not need the public key on disk anymore
1637 rm pubkey.pem
1638
1639 # Allow the security token to unlock the account of user 'lafcadio'.
1640 homectl update lafcadio --pkcs11-token-uri=auto</programlisting>
1641 </example>
1642
1643 <example>
1644 <title>Set up authentication with a FIDO2 security token:</title>
1645
1646 <programlisting># Allow a FIDO2 security token to unlock the account of user 'nihilbaxter'.
1647 homectl update nihilbaxter --fido2-device=auto</programlisting>
1648 </example>
1649
1650 <example>
1651 <title>Add a recovery key to an existing user account:</title>
1652
1653 <programlisting># Generate and add a recovery key for user 'emily'.
1654 homectl update emily --recovery-key=yes</programlisting>
1655 </example>
1656 </refsect1>
1657
1658 <refsect1>
1659 <title>See Also</title>
1660 <para><simplelist type="inline">
1661 <member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
1662 <member><citerefentry><refentrytitle>systemd-homed.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
1663 <member><citerefentry><refentrytitle>homed.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
1664 <member><citerefentry><refentrytitle>userdbctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
1665 <member><citerefentry project='man-pages'><refentrytitle>useradd</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
1666 <member><citerefentry project='man-pages'><refentrytitle>cryptsetup</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
1667 </simplelist></para>
1668 </refsect1>
1669
1670 </refentry>