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 an 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 on 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.
146
147 --no-pager
148 Do not pipe output into a pager.
149
150 --no-legend
151 Do not print the legend, i.e. column headers and the footer with
152 hints.
153
154 --no-ask-password
155 Do not query the user for authentication for privileged operations.
156
157 -h, --help
158 Print a short help text and exit.
159
160 --version
161 Print a short version string and exit.
162
164 The following options control various properties of the user
165 records/home directories that systemd-homed.service manages. These
166 switches may be used in conjunction with the create and update commands
167 for configuring various aspects of the home directory and the user
168 account:
169
170 --real-name=NAME, -c NAME
171 The real name for the user. This corresponds with the GECOS field
172 on classic UNIX NSS records.
173
174 --realm=REALM
175 The realm for the user. The realm associates a user with a specific
176 organization or installation, and allows distuingishing users of
177 the same name defined in different contexts. The realm can be any
178 string that also qualifies as valid DNS domain name, and it is
179 recommended to use the organization's or installation's domain name
180 for this purpose, but this is not enforced nor required. On each
181 system only a single user of the same name may exist, and if a user
182 with the same name and realm is seen it is assumed to refer to the
183 same user while a user with the same name but different realm is
184 considered a different user. Note that this means that two users
185 sharing the same name but with distinct realms are not allowed on
186 the same system. Assigning a realm to a user is optional.
187
188 --email-address=EMAIL
189 Takes an electronic mail address to associate with the user. On
190 log-in the $EMAIL environment variable is initialized from this
191 value.
192
193 --location=TEXT
194 Takes location specification for this user. This is free-form text,
195 which might or might not be usable by geo-location applications.
196 Example: --location="Berlin, Germany" or --location="Basement, Room
197 3a"
198
199 --icon-name=ICON
200 Takes an icon name to associate with the user, following the scheme
201 defined by the Icon Naming Specification[2].
202
203 --home-dir=PATH, -dPATH
204 Takes a path to use as home directory for the user. Note that this
205 is the directory the user's home directory is mounted to while the
206 user is logged in. This is not where the user's data is actually
207 stored, see --image-path= for that. If not specified defaults to
208 /home/$USER.
209
210 --uid=UID
211 Takes a preferred numeric UNIX UID to assign this user. If a user
212 is to be created with the specified UID and it is already taken by
213 a different user on the local system then creation of the home
214 directory is refused. Note though, if after creating the home
215 directory it is used on a different system and the configured UID
216 is taken by another user there, then systemd-homed may assign the
217 user a different UID on that system. The specified UID must be
218 outside of the system user range. It is recommended to use the
219 60001...60513 UID range for this purpose. If not specified, the UID
220 is automatically picked. If the home directory is found to be owned
221 by a different UID when logging in, the home directory and
222 everything underneath it will have its ownership changed
223 automatically before login completes.
224
225 Note that users managed by systemd-homed always have a matching
226 group associated with the same name as well as a GID matching the
227 UID of the user. Thus, configuring the GID separately is not
228 permitted.
229
230 --member-of=GROUP, -G GROUP
231 Takes a comma-separated list of auxiliary UNIX groups this user
232 shall belong to. Example: --member-of=wheel to provide the user
233 with administrator privileges. Note that systemd-homed does not
234 manage any groups besides a group matching the user in name and
235 numeric UID/GID. Thus any groups listed here must be registered
236 independently, for example with groupadd(8). Any non-existent
237 groups are ignored. This option may be used more than once, in
238 which case all specified group lists are combined. If the user is
239 currently a member of a group which is not listed, the user will be
240 removed from the group.
241
242 --skel=PATH
243 Takes a file system path to a directory. Specifies the skeleton
244 directory to initialize the home directory with. All files and
245 directories in the specified path are copied into any newly create
246 home directory. If not specified defaults to /etc/skel/.
247
248 --shell=SHELL
249 Takes a file system path. Specifies the shell binary to execute on
250 terminal logins. If not specified defaults to /bin/bash.
251
252 --setenv=VARIABLE=VALUE
253 Takes an environment variable assignment to set for all user
254 processes. Note that a number of other settings also result in
255 environment variables to be set for the user, including --email=,
256 --timezone= and --language=. May be used multiple times to set
257 multiple environment variables.
258
259 --timezone=TIMEZONE
260 Takes a timezone specification as string that sets the timezone for
261 the specified user. Expects a `tzdata` location string. When the
262 user logs in the $TZ environment variable is initialized from this
263 setting. Example: --timezone=Europe/Amsterdam will result in the
264 environment variable "TZ=:Europe/Amsterdam".
265
266 --language=LANG
267 Takes a specifier indicating the preferred language of the user.
268 The $LANG environment variable is initialized from this value on
269 login, and thus a value suitable for this environment variable is
270 accepted here, for example --language=de_DE.UTF8.
271
272 --ssh-authorized-keys=KEYS
273 Either takes a SSH authorized key line to associate with the user
274 record or a "@" character followed by a path to a file to read one
275 or more such lines from. SSH keys configured this way are made
276 available to SSH to permit access to this home directory and user
277 record. This option may be used more than once to configure
278 multiple SSH keys.
279
280 --pkcs11-token-uri=URI
281 Takes an RFC 7512 PKCS#11 URI referencing a security token (e.g.
282 YubiKey or PIV smartcard) that shall be able to unlock the user
283 account. The security token URI should reference a security token
284 with exactly one pair of X.509 certificate and private key. A
285 random secret key is then generated, encrypted with the public key
286 of the X.509 certificate, and stored as part of the user record. At
287 login time it is decrypted with the PKCS#11 module and then used to
288 unlock the account and associated resources. See below for an
289 example how to set up authentication with a security token.
290
291 Instead of a valid PKCS#11 URI, the special strings "list" and
292 "auto" may be specified. If "list" is passed, a brief table of
293 suitable, currently plugged in PKCS#11 hardware tokens is shown,
294 along with their URIs. If "auto" is passed, a suitable PKCS#11
295 hardware token is automatically selected (this operation will fail
296 if there isn't exactly one suitable token discovered). The latter
297 is a useful shortcut for the most common case where a single
298 PKCS#11 hardware token is plugged in.
299
300 Note that many hardware security tokens implement both PKCS#11/PIV
301 and FIDO2 with the "hmac-secret" extension (for example: the
302 YubiKey 5 series), as supported with the --fido2-device= option
303 below. Both mechanisms are similarly powerful, though FIDO2 is the
304 more modern technology. PKCS#11/PIV tokens have the benefit of
305 being recognizable before authentication and hence can be used for
306 implying the user identity to use for logging in, which FIDO2 does
307 not allow. PKCS#11/PIV devices generally require initialization
308 (i.e. storing a private/public key pair on them, see example below)
309 before they can be used; FIDO2 security tokens generally do not
310 required that, and work out of the box.
311
312 --fido2-device=PATH
313 Takes a path to a Linux "hidraw" device (e.g. /dev/hidraw1),
314 referring to a FIDO2 security token implementing the "hmac-secret"
315 extension that shall be able to unlock the user account. A random
316 salt value is generated on the host and passed to the FIDO2 device,
317 which calculates a HMAC hash of the salt using an internal secret
318 key. The result is then used as the key to unlock the user account.
319 The random salt is included in the user record, so that whenever
320 authentication is needed it can be passed to the FIDO2 token again.
321
322 Instead of a valid path to a FIDO2 "hidraw" device the special
323 strings "list" and "auto" may be specified. If "list" is passed, a
324 brief table of suitable discovered FIDO2 devices is shown. If
325 "auto" is passed, a suitable FIDO2 token is automatically selected,
326 if exactly one is discovered. The latter is a useful shortcut for
327 the most common case where a single FIDO2 hardware token is plugged
328 in.
329
330 Note that FIDO2 devices suitable for this option must implement the
331 "hmac-secret" extension. Most current devices (such as the YubiKey
332 5 series) do. If the extension is not implemented the device cannot
333 be used for unlocking home directories.
334
335 Note that many hardware security tokens implement both FIDO2 and
336 PKCS#11/PIV (and thus may be used with either --fido2-device= or
337 --pkcs11-token-uri=), for a discussion see above.
338
339 --locked=BOOLEAN
340 Takes a boolean argument. Specifies whether this user account shall
341 be locked. If true logins into this account are prohibited, if
342 false (the default) they are permitted (of course, only if
343 authorization otherwise succeeds).
344
345 --not-before=TIMESTAMP, --not-after=TIMESTAMP
346 These options take a timestamp string, in the format documented in
347 systemd.time(7) and configures points in time before and after
348 logins into this account are not permitted.
349
350 --rate-limit-interval=SECS, --rate-limit-burst=NUMBER
351 Configures a rate limit on authentication attempts for this user.
352 If the user attempts to authenticate more often than the specified
353 number, on a specific system, within the specified time interval
354 authentication is refused until the time interval passes. Defaults
355 to 10 times per 1min.
356
357 --password-hint=TEXT
358 Takes a password hint to store alongside the user record. This
359 string is stored accessible only to privileged users and the user
360 itself and may not be queried by other users. Example:
361 --password-hint="My first pet's name"
362
363 --enforce-password-policy=BOOL, -P
364 Takes a boolean argument. Configures whether to enforce the
365 system's password policy for this user, regarding quality and
366 strength of selected passwords. Defaults to on. -P is short for
367 ---enforce-password-policy=no.
368
369 --password-change-now=BOOL
370 Takes a boolean argument. If true the user is asked to change their
371 password on next login.
372
373 --password-change-min=TIME, --password-change-max=TIME,
374 --password-change-warn=TIME, --password-change-inactive=TIME
375 Each of these options takes a time span specification as argument
376 (in the syntax documented in systemd.time(7)) and configures
377 various aspects of the user's password expiration policy.
378 Specifically, --password-change-min= configures how much time has
379 to pass after changing the password of the user until the password
380 may be changed again. If the user tries to change their password
381 before this time passes the attempt is refused.
382 --password-change-max= configures how soon after it has been
383 changed the password expires and needs to be changed again. After
384 this time passes logging in may only proceed after the password is
385 changed. --password-change-warn= specifies how much earlier than
386 then the time configured with --password-change-max= the user is
387 warned at login to change their password as it will expire soon.
388 Finally --password-change-inactive= configures the time which has
389 to pass after the password as expired until the user is not
390 permitted to log in or change the password anymore. Note that these
391 options only apply to password authentication, and do not apply to
392 other forms of authentication, for example PKCS#11-based security
393 token authentication.
394
395 --disk-size=BYTES
396 Either takes a size in bytes as argument (possibly using the usual
397 K, M, G, ... suffixes for 1024 base values), or a percentage value
398 and configures the disk space to assign to the user. If a
399 percentage value is specified (i.e. the argument suffixed with "%")
400 it is taken relative to the available disk space of the backing
401 file system. If the LUKS2 backend is used this configures the size
402 of the loopback file and file system contained therein. For the
403 other storage backends configures disk quota using the filesystem's
404 native quota logic, if available. If not specified, defaults to 85%
405 of the available disk space for the LUKS2 backend and to no quota
406 for the others.
407
408 --access-mode=MODE
409 Takes a UNIX file access mode written in octal. Configures the
410 access mode of the home directory itself. Note that this is only
411 used when the directory is first created, and the user may change
412 this any time afterwards. Example: --access-mode=0700
413
414 --umask=MASK
415 Takes the access mode mask (in octal syntax) to apply to newly
416 created files and directories of the user ("umask"). If set this
417 controls the initial umask set for all login sessions of the user,
418 possibly overriding the system's defaults.
419
420 --nice=NICE
421 Takes the numeric scheduling priority ("nice level") to apply to
422 the processes of the user at login time. Takes a numeric value in
423 the range -20 (highest priority) to 19 (lowest priority).
424
425 --rlimit=LIMIT=VALUE[:VALUE]
426 Allows configuration of resource limits for processes of this user,
427 see getrlimit(2) for details. Takes a resource limit name (e.g.
428 "LIMIT_NOFILE") followed by an equal sign, followed by a numeric
429 limit. Optionally, separated by colon a second numeric limit may be
430 specified. If two are specified this refers to the soft and hard
431 limits, respectively. If only one limit is specified the setting
432 sets both limits in one.
433
434 --tasks-max=TASKS
435 Takes a non-zero unsigned integer as argument. Configures the
436 maximum numer of tasks (i.e. threads, where each process is at
437 least one thread) the user may have at any given time. This limit
438 applies to all tasks forked off the user's sessions, even if they
439 change user identity via su(1) or a similar tool. Use
440 --rlimit=LIMIT_NPROC= to place a limit on the tasks actually
441 running under the UID of the user, thus excluding any child
442 processes that might have changed user identity. This controls the
443 TasksMax= setting of the per-user systemd slice unit
444 user-$UID.slice. See systemd.resource-control(5) for further
445 details.
446
447 --memory-high=BYTES, --memory-max=BYTES
448 Set a limit on the memory a user may take up on a system at any
449 given time in bytes (the usual K, M, G, ... suffixes are supported,
450 to the base of 1024). This includes all memory used by the user
451 itself and all processes they forked off that changed user
452 credentials. This controls the MemoryHigh= and MemoryMax= settings
453 of the per-user systemd slice unit user-$UID.slice. See
454 systemd.resource-control(5) for further details.
455
456 --cpu-weight=WEIGHT, --io-weight=WEIGHT
457 Set CPU and IO scheduling weights of the processes of the user,
458 including those of processes forked off by the user that changed
459 user credentials. Takes a numeric value in the range 1...10000.
460 This controls the CPUWeight= and IOWeight= settings of the per-user
461 systemd slice unit user-$UID.slice. See systemd.resource-control(5)
462 for further details.
463
464 --storage=STORAGE
465 Selects the storage mechanism to use for this home directory. Takes
466 one of "luks", "fscrypt", "directory", "subvolume", "cifs". For
467 details about these mechanisms, see above. If a new home directory
468 is created and the storage type is not specifically specified,
469 homed.conf(5) defines which default storage to use.
470
471 --image-path=PATH
472 Takes a file system path. Configures where to place the user's home
473 directory. When LUKS2 storage is used refers to the path to the
474 loopback file, otherwise to the path to the home directory (which
475 may be in /home/ or any other accessible filesystem). When
476 unspecified defaults to /home/$USER.home when LUKS storage is used
477 and /home/$USER.homedir for the other storage mechanisms. Not
478 defined for the "cifs" storage mechanism. To use LUKS2 storage on a
479 regular block device (for example a USB stick) pass the path to the
480 block device here. Specifying the path to a directory here when
481 using LUKS2 storage is not allowed. Similar, specifying the path to
482 a regular file or device node is not allowed if any of the other
483 storage backends are used.
484
485 --fs-type=TYPE
486 When LUKS2 storage is used configures the file system type to use
487 inside the home directory LUKS2 container. One of "ext4", "xfs",
488 "btrfs". If not specified homed.conf(5) defines which default file
489 system type to use. Note that "xfs" is not recommended as its
490 support for file system resizing is too limited.
491
492 --luks-discard=BOOL
493 When LUKS2 storage is used configures whether to enable the
494 "discard" feature of the file system. If enabled the file system on
495 top of the LUKS2 volume will report empty block information to
496 LUKS2 and the loopback file below, ensuring that empty space in the
497 home directory is returned to the backing file system below the
498 LUKS2 volume, resulting in a "sparse" loopback file. This option
499 mostly defaults to off, since this permits over-committing home
500 directories which results in I/O errors if the underlying file
501 system runs full while the upper file system wants to allocate a
502 block. Such I/O errors are generally not handled well by file
503 systems nor applications. When LUKS2 storage is used on top of
504 regular block devices (instead of on top a loopback file) the
505 discard logic defaults to on.
506
507 --luks-offline-discard=BOOL
508 Similar to --luks-discard=, controls the trimming of the file
509 system. However, while --luks-discard= controls what happens when
510 the home directory is active, --luks-offline-discard= controls what
511 happens when it becomes inactive, i.e. whether to trim/allocate the
512 storage when deactivating the home directory. This option defaults
513 to on, to ensure disk space is minimized while a user is not logged
514 in.
515
516 --luks-cipher=CIPHER, --luks-cipher-mode=MODE,
517 --luks-volume-key-size=BITS, --luks-pbkdf-type=TYPE,
518 --luks-pbkdf-hash-algorithm=ALGORITHM, --luks-pbkdf-time-cost=SECONDS,
519 --luks-pbkdf-memory-cost=BYTES, --luks-pbkdf-parallel-threads=THREADS
520 Configures various cryptographic parameters for the LUKS2 storage
521 mechanism. See cryptsetup(8) for details on the specific
522 attributes.
523
524 --nosuid=BOOL, --nodev=BOOL, --noexec=BOOL
525 Configures the "nosuid", "nodev" and "noexec" mount options for the
526 home directories. By default "nodev" and "nosuid" are on, while
527 "noexec" is off. For details about these mount options see
528 mount(8).
529
530 --cifs-domain=DOMAIN, --cifs-user-name=USER, --cifs-service=SERVICE
531 Configures the Windows File Sharing (CIFS) domain and user to
532 associate with the home directory/user account, as well as the file
533 share ("service") to mount as directory. The latter is used when
534 "cifs" storage is selected.
535
536 --stop-delay=SECS
537 Configures the time the per-user service manager shall continue to
538 run after the all sessions of the user ended. The default is
539 configured in logind.conf(5) (for home directories of LUKS2 storage
540 located on removable media this defaults to 0 though). A longer
541 time makes sure quick, repetitive logins are more efficient as the
542 user's service manager doesn't have to be started every time.
543
544 --kill-processes=BOOL
545 Configures whether to kill all processes of the user on logout. The
546 default is configured in logind.conf(5).
547
548 --auto-login=BOOL
549 Takes a boolean argument. Configures whether the graphical UI of
550 the system should automatically log this user in if possible.
551 Defaults to off. If less or more than one user is marked this way
552 automatic login is disabled.
553
555 The following commands are understood:
556
557 list
558 List all home directories (along with brief details) currently
559 managed by systemd-homed.service. This command is also executed if
560 none is specified on the command line. (Note that the list of users
561 shown by this command does not include users managed by other
562 subsystems, such as system users or any traditional users listed in
563 /etc/passwd.)
564
565 activate USER [USER...]
566 Activate one or more home directories. The home directories of each
567 listed user will be activated and made available under their mount
568 points (typically in /home/$USER). Note that any home activated
569 this way stays active indefinitely, until it is explicitly
570 deactivated again (with deactivate, see below), or the user logs in
571 and out again and it thus is deactivated due to the automatic
572 deactivation-on-logout logic.
573
574 Activation of a home directory involves various operations that
575 depend on the selected storage mechanism. If the LUKS2 mechanism is
576 used, this generally involves: inquiring the user for a password,
577 setting up a loopback device, validating and activating the LUKS2
578 volume, checking the file system, mounting the file system, and
579 potentially changing the ownership of all included files to the
580 correct UID/GID.
581
582 deactivate USER [USER...]
583 Deactivate one or more home directories. This undoes the effect of
584 activate.
585
586 inspect USER [USER...]
587 Show various details about the specified home directories. This
588 shows various information about the home directory and its user
589 account, including runtime data such as current state, disk use and
590 similar. Combine with --json= to show the detailed JSON user record
591 instead, possibly combined with --export-format= to suppress
592 certain aspects of the output.
593
594 authenticate USER [USER...]
595 Validate authentication credentials of a home directory. This
596 queries the caller for a password (or similar) and checks that it
597 correctly unlocks the home directory. This leaves the home
598 directory in the state it is in, i.e. it leaves the home directory
599 in inactive state if it was inactive before, and in active state if
600 it was active before.
601
602 create USER, create --identity=PATH [USER]
603 Create a new home directory/user account of the specified name. Use
604 the various user record property options (as documented above) to
605 control various aspects of the home directory and its user
606 accounts.
607
608 The specified user name should follow the strict syntax described
609 on User/Group Name Syntax[3].
610
611 remove USER
612 Remove a home directory/user account. This will remove both the
613 home directory's user record and the home directory itself, and
614 thus delete all files and directories owned by the user.
615
616 update USER, update --identity=PATH [USER]
617 Update a home directory/user account. Use the various user record
618 property options (as documented above) to make changes to the
619 account, or alternatively provide a full, updated JSON user record
620 via the --identity= option.
621
622 Note that changes to user records not signed by a cryptographic
623 private key available locally are not permitted, unless --identity=
624 is used with a user record that is already correctly signed by a
625 recognized private key.
626
627 passwd USER
628 Change the password of the specified home directory/user account.
629
630 resize USER BYTES
631 Change the disk space assigned to the specified home directory. If
632 the LUKS2 storage mechanism is used this will automatically resize
633 the loopback file and the file system contained within. Note that
634 if "ext4" is used inside of the LUKS2 volume, it is necessary to
635 deactivate the home directory before shrinking it (i.e the user has
636 to log out). Growing can be done while the home directory is
637 active. If "xfs" is used inside of the LUKS2 volume the home
638 directory may not be shrunk whatsoever. On all three of "ext4",
639 "xfs" and "btrfs" the home directory may be grown while the user is
640 logged in, and on the latter also shrunk while the user is logged
641 in. If the "subvolume", "directory", "fscrypt" storage mechanisms
642 are used, resizing will change file system quota.
643
644 lock USER
645 Temporarily suspend access to the user's home directory and remove
646 any associated cryptographic keys from memory. Any attempts to
647 access the user's home directory will stall until the home
648 directory is unlocked again (i.e. re-authenticated). This
649 functionality is primarily intended to be used during system
650 suspend to make sure the user's data cannot be accessed until the
651 user re-authenticates on resume. This operation is only defined for
652 home directories that use the LUKS2 storage mechanism.
653
654 unlock USER
655 Resume access to the user's home directory again, undoing the
656 effect of lock above. This requires authentication of the user, as
657 the cryptographic keys required for access to the home directory
658 need to be reacquired.
659
660 lock-all
661 Execute the lock command on all suitable home directories at once.
662 This operation is generally executed on system suspend (i.e. by
663 systemctl suspend and related commands), to ensure all active
664 user's cryptographic keys for accessing their home directories are
665 removed from memory.
666
667 with USER COMMAND...
668 Activate the specified user's home directory, run the specified
669 command (under the caller's identity, not the specified user's) and
670 deactivate the home directory afterwards again (unless the user is
671 logged in otherwise). This command is useful for running privileged
672 backup scripts and such, but requires authentication with the
673 user's credentials in order to be able to unlock the user's home
674 directory.
675
677 On success, 0 is returned, a non-zero failure code otherwise.
678
680 $SYSTEMD_PAGER
681 Pager to use when --no-pager is not given; overrides $PAGER. If
682 neither $SYSTEMD_PAGER nor $PAGER are set, a set of well-known
683 pager implementations are tried in turn, including less(1) and
684 more(1), until one is found. If no pager implementation is
685 discovered no pager is invoked. Setting this environment variable
686 to an empty string or the value "cat" is equivalent to passing
687 --no-pager.
688
689 $SYSTEMD_LESS
690 Override the options passed to less (by default "FRSXMK").
691
692 Users might want to change two options in particular:
693
694 K
695 This option instructs the pager to exit immediately when Ctrl+C
696 is pressed. To allow less to handle Ctrl+C itself to switch
697 back to the pager command prompt, unset this option.
698
699 If the value of $SYSTEMD_LESS does not include "K", and the
700 pager that is invoked is less, Ctrl+C will be ignored by the
701 executable, and needs to be handled by the pager.
702
703 X
704 This option instructs the pager to not send termcap
705 initialization and deinitialization strings to the terminal. It
706 is set by default to allow command output to remain visible in
707 the terminal even after the pager exits. Nevertheless, this
708 prevents some pager functionality from working, in particular
709 paged output cannot be scrolled with the mouse.
710
711 See less(1) for more discussion.
712
713 $SYSTEMD_LESSCHARSET
714 Override the charset passed to less (by default "utf-8", if the
715 invoking terminal is determined to be UTF-8 compatible).
716
717 $SYSTEMD_PAGERSECURE
718 Takes a boolean argument. When true, the "secure" mode of the pager
719 is enabled; if false, disabled. If $SYSTEMD_PAGERSECURE is not set
720 at all, secure mode is enabled if the effective UID is not the same
721 as the owner of the login session, see geteuid(2) and
722 sd_pid_get_owner_uid(3). In secure mode, LESSSECURE=1 will be set
723 when invoking the pager, and the pager shall disable commands that
724 open or create new files or start new subprocesses. When
725 $SYSTEMD_PAGERSECURE is not set at all, pagers which are not known
726 to implement secure mode will not be used. (Currently only less(1)
727 implements secure mode.)
728
729 Note: when commands are invoked with elevated privileges, for
730 example under sudo(8) or pkexec(1), care must be taken to ensure
731 that unintended interactive features are not enabled. "Secure" mode
732 for the pager may be enabled automatically as describe above.
733 Setting SYSTEMD_PAGERSECURE=0 or not removing it from the inherited
734 environment allows the user to invoke arbitrary commands. Note that
735 if the $SYSTEMD_PAGER or $PAGER variables are to be honoured,
736 $SYSTEMD_PAGERSECURE must be set too. It might be reasonable to
737 completly disable the pager using --no-pager instead.
738
739 $SYSTEMD_COLORS
740 The value must be a boolean. Controls whether colorized output
741 should be generated. This can be specified to override the decision
742 that systemd makes based on $TERM and what the console is connected
743 to.
744
745 $SYSTEMD_URLIFY
746 The value must be a boolean. Controls whether clickable links
747 should be generated in the output for terminal emulators supporting
748 this. This can be specified to override the decision that systemd
749 makes based on $TERM and other conditions.
750
752 Example 1. Create a user "waldo" in the administrator group "wheel",
753 and assign 500 MiB disk space to them.
754
755 homectl create waldo --real-name="Waldo McWaldo" -G wheel --disk-size=500M
756
757 Example 2. Create a user "wally" on a USB stick, and assign a maximum
758 of 500 concurrent tasks to them.
759
760 homectl create wally --real-name="Wally McWally" --image-path=/dev/disk/by-id/usb-SanDisk_Ultra_Fit_476fff954b2b5c44-0:0 --tasks-max=500
761
762 Example 3. Change nice level of user "odlaw" to +5 and make sure the
763 environment variable $SOME is set to the string "THING" for them on
764 login.
765
766 homectl update odlaw --nice=5 --setenv=SOME=THING
767
768 Example 4. Set up authentication with a YubiKey security token using
769 PKCS#11/PIV:
770
771 # Clear the Yubikey from any old keys (careful!)
772 ykman piv reset
773
774 # Generate a new private/public key pair on the device, store the public key in 'pubkey.pem'.
775 ykman piv generate-key -a RSA2048 9d pubkey.pem
776
777 # Create a self-signed certificate from this public key, and store it on the device.
778 ykman piv generate-certificate --subject "Knobelei" 9d pubkey.pem
779
780 # We don't need the public key on disk anymore
781 rm pubkey.pem
782
783 # Allow the security token to unlock the account of user 'lafcadio'.
784 homectl update lafcadio --pkcs11-token-uri=auto
785
786 Example 5. Set up authentication with a FIDO2 security token:
787
788 # Allow a FIDO2 security token to unlock the account of user 'nihilbaxter'.
789 homectl update nihilbaxter --fido2-device=auto
790
792 systemd(1), systemd-homed.service(8), homed.conf(5), userdbctl(1),
793 useradd(8), cryptsetup(8)
794
796 1. JSON User Records
797 https://systemd.io/USER_RECORD
798
799 2. Icon Naming Specification
800 https://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
801
802 3. User/Group Name Syntax
803 https://systemd.io/USER_NAMES
804
805
806
807systemd 246 HOMECTL(1)