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 preceeding 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 "-" reads 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. When logging in and the home directory is
221 found to be owned by a UID not matching the user's assigned one the
222 home directory and all files and directories inside it will have
223 their ownership changed 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). If non-existant groups
237 that are listed there are ignored. This option may be used more
238 than once, in which case all specified group lists are combined.
239
240 --skel=PATH
241 Takes a file system path to a directory. Specifies the skeleton
242 directory to initialize the home directory with. All files and
243 directories in the specified are copied into any newly create home
244 directory. If not specified defaults to /etc/skel/.
245
246 --shell=SHELL
247 Takes a file system path. Specifies the shell binary to execute on
248 terminal logins. If not specified defaults to /bin/bash.
249
250 --setenv=VARIABLE=VALUE
251 Takes an environment variable assignment to set for all user
252 processes. Note that a number of other settings also result in
253 environment variables to be set for the user, including --email=,
254 --timezone= and --language=. May be used multiple times to set
255 multiple environment variables.
256
257 --timezone=TIMEZONE
258 Takes a timezone specification as string that sets the timezone for
259 the specified user. Expects a `tzdata` location string. When the
260 user logs in the $TZ environment variable is initialized from this
261 setting. Example: --timezone=Europe/Amsterdam will result in the
262 environment variable "TZ=:Europe/Amsterdam".
263
264 --language=LANG
265 Takes a specifier indicating the preferred language of the user.
266 The $LANG environment variable is initialized from this value on
267 login, and thus a value suitable for this environment variable is
268 accepted here, for example --language=de_DE.UTF8
269
270 --ssh-authorized-keys=KEYS
271 Either takes a SSH authorized key line to associate with the user
272 record or a "@" character followed by a path to a file to read one
273 or more such lines from. SSH keys configured this way are made
274 available to SSH to permit access to this home directory and user
275 record. This option may be used more than once to configure
276 multiple SSH keys.
277
278 --pkcs11-token-uri=URI
279 Takes an RFC 7512 PKCS#11 URI referencing a security token (e.g.
280 YubiKey or PIV smartcard) that shall be able to unlock the user
281 account. The security token URI should reference a security token
282 with exactly one pair of X.509 certificate and private key. A
283 random secret key is then generated, encrypted with the public key
284 of the X.509 certificate, and stored as part of the user record. At
285 login time it is decrypted with the PKCS#11 module and then used to
286 unlock the account and associated resources. See below for an
287 example how to set up authentication with security token.
288
289 --locked=BOOLEAN
290 Takes a boolean argument. Specifies whether this user account shall
291 be locked. If true logins into this account are prohibited, if
292 false (the default) they are permitted (of course, only if
293 authorization otherwise succeeds).
294
295 --not-before=TIMESTAMP, --not-after=TIMESTAMP
296 These options take a timestamp string, in the format documented in
297 systemd.time(7) and configures points in time before and after
298 logins into this account are not permitted.
299
300 --rate-limit-interval=SECS, --rate-limit-burst=NUMBER
301 Configures a rate limit on authentication attempts for this user.
302 If the user attempts to authenticate more often than the specified
303 number, on a specific system, within the specified time interval
304 authentication is refused until the time interval passes. Defaults
305 to 10 times per 1min.
306
307 --password-hint=TEXT
308 Takes a password hint to store alongside the user record. This
309 string is stored accessible only to privileged users and the user
310 itself and may not be queried by other users. Example:
311 --password-hint="My first pet's name"
312
313 --enforce-password-policy=BOOL, -P
314 Takes a boolean argument. Configures whether to enforce the
315 system's password policy for this user, regarding quality and
316 strength of selected passwords. Defaults to on. -P is short for
317 ---enforce-password-policy=no.
318
319 --password-change-now=BOOL
320 Takes a boolean argument. If true the user is asked to change their
321 password on next login.
322
323 --password-change-min=TIME, --password-change-max=TIME,
324 --password-change-warn=TIME, --password-change-inactive=TIME
325 Each of these options takes a time span specification as argument
326 (in the syntax documented in systemd.time(5)) and configure various
327 aspects of the user's password expiration policy. Specifically,
328 --password-change-min= configures how much time has to pass after
329 changing the password of the user until the password may be changed
330 again. If the user tries to change their password before this time
331 passes the attempt is refused. --password-change-max= configures
332 how much time has to pass after the the password is changed until
333 the password expires and needs to be changed again. After this time
334 passes any attempts to log in may only proceed after the password
335 is changed. --password-change-warn= specifies how much earlier
336 than then the time configured with --password-change-max= the user
337 is warned at login to change their password as it will expire soon.
338 Finally --password-change-inactive= configures the time which has
339 to pass after the password as expired until the user is not
340 permitted to log in or change the password anymore. Note that these
341 options only apply to password authentication, and do not apply to
342 other forms of authentication, for example PKCS#11-based security
343 token authentication.
344
345 --disk-size=BYTES
346 Either takes a size in bytes as argument (possibly using the usual
347 K, M, G, ... suffixes for 1024 base values), or a percentage value
348 and configures the disk space to assign to the user. If a
349 percentage value is specified (i.e. the argument suffixed with "%")
350 it is taken relative to the available disk space of the backing
351 file system. If the LUKS2 backend is used this configures the size
352 of the loopback file and file system contained therein. For the
353 other storage backends configures disk quota using the filesystem's
354 native quota logic, if available. If not specified, defaults to 85%
355 of the available disk space for the LUKS2 backend and to no quota
356 for the others.
357
358 --access-mode=MODE
359 Takes a UNIX file access mode written in octal. Configures the
360 access mode of the home directory itself. Note that this is only
361 used when the directory is first created, and the user may change
362 this any time afterwards. Example: --access-mode=0700
363
364 --umask=MASK
365 Takes the access mode mask (in octal syntax) to apply to newly
366 created files and directories of the user ("umask"). If set this
367 controls the initial umask set for all login sessions of the user,
368 possibly overriding the system's defaults.
369
370 --nice=NICE
371 Takes the numeric scheduling priority ("nice level") to apply to
372 the processes of the user at login time. Takes a numeric value in
373 the range -20 (highest priority) to 19 (lowest priority).
374
375 --rlimit=LIMIT=VALUE[:VALUE]
376 Allows configuration of resource limits for processes of this user,
377 see getrlimit(2) for details. Takes a resource limit name (e.g.
378 "LIMIT_NOFILE") followed by an equal sign, followed by a numeric
379 limit. Optionally, separated by colon a second numeric limit may be
380 specified. If two are specified this refers to the soft and hard
381 limits, respectively. If only one limit is specified the setting
382 sets both limits in one.
383
384 --tasks-max=TASKS
385 Takes a non-zero unsigned integer as argument. Configures the
386 maximum numer of tasks (i.e. processes and threads) the user may
387 have at any given time. This limit applies to all tasks forked off
388 the user's sessions, even if they change user identity via su(1) or
389 a similar tool. Use --rlimit=LIMIT_NPROC= to place a limit on the
390 tasks actually running under the UID of the user, thus excluding
391 any child processes that might have changed user identity. This
392 controls the TasksMax= settting of the per-user systemd slice unit
393 user-$UID.slice. See systemd.resource-control(5) for further
394 details.
395
396 --memory-high=BYTES, --memory-max=BYTES
397 Set a limit on the memory a user may take up on a system at any
398 given time in bytes (the usual K, M, G, ... suffixes are supported,
399 to the base of 1024). This includes all memory used by the user
400 itself and all processes they forked off that changed user
401 credentials. This controls the MemoryHigh= and MemoryMax= settings
402 of the per-user systemd slice unit user-$UID.slice. See
403 systemd.resource-control(5) for further details.
404
405 --cpu-weight=WEIGHT, --io-weight=WEIGHT
406 Set a CPU and IO scheduling weights of the processes of the user,
407 including those of processes forked off by the user that changed
408 user credentials. Takes a numeric value in the range 1...10000.
409 This controls the CPUWeight= and IOWeight= settings of the per-user
410 systemd slice unit user-$UID.slice. See systemd.resource-control(5)
411 for further details.
412
413 --storage=STORAGE
414 Selects the storage mechanism to use for this home directory. Takes
415 one of "luks", "fscrypt", "directory", "subvolume", "cifs". For
416 details about these mechanisms, see above. If a new home directory
417 is created and the storage type is not specifically specified
418 defaults to "luks" if supported, "subvolume" as first fallback if
419 supported, and "directory" if not.
420
421 --image-path=PATH
422 Takes a file system path. Configures where to place the user's home
423 directory. When LUKS2 storage is used refers to the path to the
424 loopback file, otherwise to the path to the home directory. When
425 unspecified defaults to /home/$USER.home when LUKS storage is used
426 and /home/$USER.homedir for the other storage mechanisms. Not
427 defined for the "cifs" storage mechanism. To use LUKS2 storage on a
428 regular block device (for example a USB stick) pass the path to the
429 block device here.
430
431 --fs-type=TYPE
432 When LUKS2 storage is used configures the file system type to use
433 inside the home directory LUKS2 container. One of "ext4", "xfs",
434 "btrfs". If not specified defaults to "ext4". Note that "xfs" is
435 not recommended as its support for file system resizing is too
436 limited.
437
438 --luks-discard=BOOL
439 When LUKS2 storage is used configures whether to enable the
440 "discard" feature of the file system. If enabled the file system on
441 top of the LUKS2 volume will report empty block information to
442 LUKS2 and the loopback file below, ensuring that empty space in the
443 home directory is returned to the backing file system below the
444 LUKS2 volume, resulting in a "sparse" loopback file. This option
445 mostly defaults to off, since this permits over-committing home
446 directories which results in I/O errors if the underlying file
447 system runs full while the upper file system wants to allocate a
448 block. Such I/O errors are generally not handled well by file
449 systems nor applications. When LUKS2 storage is used on top of
450 regular block devices (instead of on top a loopback file) the
451 discard logic defaults to on.
452
453 --luks-cipher=CIPHER, --luks-cipher-mode=MODE,
454 --luks-volume-key-size=BITS, --luks-pbkdf-type=TYPE,
455 --luks-pbkdf-hash-algorithm=ALGORITHM, --luks-pbkdf-time-cost=SECONDS,
456 --luks-pbkdf-memory-cost=BYTES, --luks-pbkdf-parallel-threads=THREADS
457 Configures various cryptographic parameters for the LUKS2 storage
458 mechanism. See cryptsetup(8) for details on the specific
459 attributes.
460
461 --nosuid=BOOL, --nodev=BOOL, --noexec=BOOL
462 Configures the "nosuid", "nodev" and "noexec" mount options for the
463 home directories. By default "nodev" and "nosuid" are on, while
464 "noexec" is off. For details about these mount options see
465 mount(8).
466
467 --cifs-domain=DOMAIN, --cifs-user-name=USER, --cifs-service=SERVICE
468 Configures the Windows File Sharing (CIFS) domain and user to
469 associate with the home directory/user account, as well as the file
470 share ("service") to mount as directory. The latter is used when
471 "cifs" storage is selected.
472
473 --stop-delay=SECS
474 Configures the time the per-user service manager shall continue to
475 run after the all sessions of the user ended. The default is
476 configured in logind.conf(5) (for home directories of LUKS2 storage
477 located on removable media this defaults to 0 though). A longer
478 time makes sure quick, repetitive logins are more efficient as the
479 user's service manager doesn't have to be started every time.
480
481 --kill-processes=BOOL
482 Configures whether to kill all processes of the user on logout. The
483 default is configured in logind.conf(5).
484
485 --auto-login=BOOL
486 Takes a boolean argument. Configures whether the graphical UI of
487 the system should automatically log this user in if possible.
488 Defaults to off. If less or more than one user is marked this way
489 automatic login is disabled.
490
492 The following commands are understood:
493
494 list
495 List all home directories (along with brief details) currently
496 managed by systemd-homed.service. This command is also executed if
497 none is specified on the command line. (Note that the list of users
498 shown by this command does not include users managed by other
499 subsystems, such as system users or any traditional users listed in
500 /etc/passwd.)
501
502 activate USER [USER...]
503 Activate one or more home directories. The home directories of each
504 listed user will be activated and made available under their mount
505 points (typically in /home/$USER). Note that any home activated
506 this way stays active indefinitely, until it is explicitly
507 deactivated again (with deactivate, see below), or the user logs in
508 and out again and it thus is deactivated due to the automatic
509 deactivation-on-logout logic.
510
511 Activation of a home directory involves various operations that
512 depend on the selected storage mechanism. If the LUKS2 mechanism is
513 used, this generally involves: inquiring the user for a password,
514 setting up a loopback device, validating and activating the LUKS2
515 volume, checking the file system, mounting the file system, and
516 potentiatlly changing the ownership of all included files to the
517 correct UID/GID.
518
519 deactivate USER [USER...]
520 Deactivate one or more home directories. This undoes the effect of
521 activate.
522
523 inspect USER [USER...]
524 Show various details about the specified home directories. This
525 shows various information about the home directory and its user
526 account, including runtime data such as current state, disk use and
527 similar. Combine with --json= to show the detailed JSON user record
528 instead, possibly combined with --export-format= to suppress
529 certain aspects of the output.
530
531 authenticate USER [USER...]
532 Validate authentication credentials of a home directory. This
533 queries the caller for a password (or similar) and checks that it
534 correctly unlocks the home directory. This leaves the home
535 directory in the state it is in, i.e. it leaves the home directory
536 in inactive state if it was inactive before, and in active state if
537 it was active before.
538
539 create USER, create --identity=PATH [USER]
540 Create a new home directory/user account of the specified name. Use
541 the various user record property options (as documented above) to
542 control various aspects of the home directory and its user
543 accounts.
544
545 remove USER
546 Remove a home directory/user account. This will remove both the
547 home directory's user record and the home directory itself, and
548 thus delete all files and directories owned by the user.
549
550 update USER, update --identity=PATH [USER]
551 Update a home directory/user account. Use the various user record
552 property options (as documented above) to make changes to the
553 account, or alternatively provide a full, updated JSON user record
554 via the --identity= option.
555
556 Note that changes to user records not signed by a cryptographic
557 private key available locally are not permitted, unless --identity=
558 is used with a user record that is already correctly signed by a
559 recognized private key.
560
561 passwd USER
562 Change the password of the specified home direcory/user account.
563
564 resize USER BYTES
565 Change the disk space assigned to the specified home directory. If
566 the LUKS2 storage mechanism is used this will automatically resize
567 the loopback file and the file system contained within. Note that
568 if "ext4" is used inside of the LUKS2 volume, it is necessary to
569 deactivate the home directory before shrinking it (i.e the user has
570 to log out). Growing can be done while the home directory is
571 active. If "xfs" is used inside of the LUKS2 volume the home
572 directory may not be shrunk whatsoever. On all three of "ext4",
573 "xfs" and "btrfs" the home directory may be grown while the user is
574 logged in, and on the latter also shrunk while the user is logged
575 in. If the "subvolume", "directory", "fscrypt" storage mechanisms
576 are used, resizing will change file system quota.
577
578 lock USER
579 Temporarily suspend access to the user's home directory and remove
580 any associated cryptographic keys from memory. Any attempts to
581 access the user's home directory will stall until the home
582 directory is unlocked again (i.e. re-authenticated). This
583 functionality is primarily intended to be used during system
584 suspend to make sure the user's data cannot be accessed until the
585 user re-authenticates on resume. This operation is only defined for
586 home directories that use the LUKS2 storage mechanism.
587
588 unlock USER
589 Resume access to the user's home directory again, undoing the
590 effect of lock above. This requires authentication of the user, as
591 the cryptographic keys required for access to the home directory
592 need to be reacquired.
593
594 lock-all
595 Execute the lock command on all suitable home directories at once.
596 This operation is generally executed on system suspend (i.e. by
597 systemctl suspend and related commands), to ensure all active
598 user's cryptographic keys for accessing their home directories are
599 removed from memory.
600
601 with USER COMMAND...
602 Activate the specified user's home directory, run the specified
603 command (under the caller's identity, not the specified user's) and
604 deactivate the home directory afterwards again (unless the user is
605 logged in otherwise). This command is useful for running privileged
606 backup scripts and such, but requires authentication with the
607 user's credentials in order to be able to unlock the user's home
608 directory.
609
611 On success, 0 is returned, a non-zero failure code otherwise.
612
614 $SYSTEMD_PAGER
615 Pager to use when --no-pager is not given; overrides $PAGER. If
616 neither $SYSTEMD_PAGER nor $PAGER are set, a set of well-known
617 pager implementations are tried in turn, including less(1) and
618 more(1), until one is found. If no pager implementation is
619 discovered no pager is invoked. Setting this environment variable
620 to an empty string or the value "cat" is equivalent to passing
621 --no-pager.
622
623 $SYSTEMD_LESS
624 Override the options passed to less (by default "FRSXMK").
625
626 Users might want to change two options in particular:
627
628 K
629 This option instructs the pager to exit immediately when Ctrl+C
630 is pressed. To allow less to handle Ctrl+C itself to switch
631 back to the pager command prompt, unset this option.
632
633 If the value of $SYSTEMD_LESS does not include "K", and the
634 pager that is invoked is less, Ctrl+C will be ignored by the
635 executable, and needs to be handled by the pager.
636
637 X
638 This option instructs the pager to not send termcap
639 initialization and deinitialization strings to the terminal. It
640 is set by default to allow command output to remain visible in
641 the terminal even after the pager exits. Nevertheless, this
642 prevents some pager functionality from working, in particular
643 paged output cannot be scrolled with the mouse.
644
645 See less(1) for more discussion.
646
647 $SYSTEMD_LESSCHARSET
648 Override the charset passed to less (by default "utf-8", if the
649 invoking terminal is determined to be UTF-8 compatible).
650
651 $SYSTEMD_COLORS
652 The value must be a boolean. Controls whether colorized output
653 should be generated. This can be specified to override the decision
654 that systemd makes based on $TERM and what the console is connected
655 to.
656
657 $SYSTEMD_URLIFY
658 The value must be a boolean. Controls whether clickable links
659 should be generated in the output for terminal emulators supporting
660 this. This can be specified to override the decision that systemd
661 makes based on $TERM and other conditions.
662
664 Example 1. Create a user "waldo" in the administrator group "wheel",
665 and assign 500 MiB disk space to them.
666
667 homectl create waldo --real-name="Waldo McWaldo" -G wheel --disk-size=500M
668
669 Example 2. Create a user "wally" on a USB stick, and assign a maximum
670 of 500 concurrent tasks to them.
671
672 homectl create wally --real-name="Wally McWally" --image-path=/dev/disk/by-id/usb-SanDisk_Ultra_Fit_476fff954b2b5c44-0:0 --tasks-max=500
673
674 Example 3. Change nice level of user "odlaw" to +5 and make sure the
675 environment variable $SOME is set to the string "THING" for them on
676 login.
677
678 homectl update odlaw --nice=5 --setenv=SOME=THING
679
680 Example 4. Set up authentication with a YubiKey security token:
681
682 # Clear the Yubikey from any old keys (careful!)
683 ykman piv reset
684
685 # Generate a new private/public key pair on the device, store the public key in 'pubkey.pem'.
686 ykman piv generate-key -a RSA2048 9d pubkey.pem
687
688 # Create a self-signed certificate from this public key, and store it on the device.
689 ykman piv generate-certificate --subject "Knobelei" 9d pubkey.pem
690
691 # We don't need the publibc key on disk anymore
692 rm pubkey.pem
693
694 # Check if the newly create key on the Yubikey shows up as token in PKCS#11. Have a look at the output, and
695 # copy the resulting token URI to the clipboard.
696 p11tool --list-tokens
697
698 # Allow the security token referenced by the determined PKCS#11 URI to unlock the account of user
699 # 'lafcadio'. (Replace the '...' by the URI from the clipboard.)
700 homectl update lafcadio --pkcs11-token-uri=...
701
703 systemd(1), systemd-homed.service(8), userdbctl(1), useradd(8),
704 cryptsetup(8)
705
707 1. JSON User Records
708 https://systemd.io/USER_RECORDS
709
710 2. Icon Naming Specification
711 https://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
712
713
714
715systemd 245 HOMECTL(1)