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