1SYSTEMD-SYSUSERS(8) systemd-sysusers SYSTEMD-SYSUSERS(8)
2
3
4
6 systemd-sysusers, systemd-sysusers.service - Allocate system users and
7 groups
8
10 systemd-sysusers [OPTIONS...] [CONFIGFILE...]
11
12 systemd-sysusers.service
13
15 systemd-sysusers creates system users and groups, based on files in the
16 format described in sysusers.d(5).
17
18 If invoked with no arguments, it applies all directives from all files
19 found in the directories specified by sysusers.d(5). When invoked with
20 positional arguments, if option --replace=PATH is specified, arguments
21 specified on the command line are used instead of the configuration
22 file PATH. Otherwise, just the configuration specified by the command
23 line arguments is executed. The string "-" may be specified instead of
24 a filename to instruct systemd-sysusers to read the configuration from
25 standard input. If the argument is a relative path, all configuration
26 directories are searched for a matching file and the file found that
27 has the highest priority is executed. If the argument is an absolute
28 path, that file is used directly without searching of the configuration
29 directories.
30
32 The following options are understood:
33
34 --root=root
35 Takes a directory path as an argument. All paths will be prefixed
36 with the given alternate root path, including config search paths.
37
38 --image=image
39 Takes a path to a disk image file or block device node. If
40 specified all operations are applied to file system in the
41 indicated disk image. This is similar to --root= but operates on
42 file systems stored in disk images or block devices. The disk image
43 should either contain just a file system or a set of file systems
44 within a GPT partition table, following the Discoverable Partitions
45 Specification[1]. For further information on supported disk images,
46 see systemd-nspawn(1)'s switch of the same name.
47
48 --replace=PATH
49 When this option is given, one or more positional arguments must be
50 specified. All configuration files found in the directories listed
51 in sysusers.d(5) will be read, and the configuration given on the
52 command line will be handled instead of and with the same priority
53 as the configuration file PATH.
54
55 This option is intended to be used when package installation
56 scripts are running and files belonging to that package are not yet
57 available on disk, so their contents must be given on the command
58 line, but the admin configuration might already exist and should be
59 given higher priority.
60
61 Example 1. RPM installation script for radvd
62
63 echo 'u radvd - "radvd daemon"' | \
64 systemd-sysusers --replace=/usr/lib/sysusers.d/radvd.conf -
65
66 This will create the radvd user as if
67 /usr/lib/sysusers.d/radvd.conf was already on disk. An admin might
68 override the configuration specified on the command line by placing
69 /etc/sysusers.d/radvd.conf or even
70 /etc/sysusers.d/00-overrides.conf.
71
72 Note that this is the expanded form, and when used in a package,
73 this would be written using a macro with "radvd" and a file
74 containing the configuration line as arguments.
75
76 --dry-run
77 Process the configuration and figure out what entries would be
78 created, but don't actually write anything.
79
80 --inline
81 Treat each positional argument as a separate configuration line
82 instead of a file name.
83
84 --cat-config
85 Copy the contents of config files to standard output. Before each
86 file, the filename is printed as a comment.
87
88 --no-pager
89 Do not pipe output into a pager.
90
91 -h, --help
92 Print a short help text and exit.
93
94 --version
95 Print a short version string and exit.
96
98 systemd-sysusers supports the service credentials logic as implemented
99 by LoadCredential=/SetCredential= (see systemd.exec(1) for details).
100 The following credentials are used when passed in:
101
102 "passwd.hashed-password.user"
103 A UNIX hashed password string to use for the specified user, when
104 creating an entry for it. This is particularly useful for the
105 "root" user as it allows provisioning the default root password to
106 use via a unit file drop-in or from a container manager passing in
107 this credential. Note that setting this credential has no effect if
108 the specified user account already exists. This credential is hence
109 primarily useful in first boot scenarios or systems that are fully
110 stateless and come up with an empty /etc/ on every boot.
111
112 "passwd.plaintext-password.user"
113 Similar to "passwd.hashed-password.user" but expect a literal,
114 plaintext password, which is then automatically hashed before used
115 for the user account. If both the hashed and the plaintext
116 credential are specified for the same user the former takes
117 precedence. It's generally recommended to specify the hashed
118 version; however in test environments with weaker requirements on
119 security it might be easier to pass passwords in plaintext instead.
120
121 "passwd.shell.user"
122 Specifies the shell binary to use for the specified account when
123 creating it.
124
125 "sysusers.extra"
126 The contents of this credential may contain additional lines to
127 operate on. The credential contents should follow the same format
128 as any other sysusers.d/ drop-in. If this credential is passed it
129 is processed after all of the drop-in files read from the file
130 system.
131
132 Note that by default the systemd-sysusers.service unit file is set up
133 to inherit the "passwd.hashed-password.root",
134 "passwd.plaintext-password.root", "passwd.shell.root" and
135 "sysusers.extra" credentials from the service manager. Thus, when
136 invoking a container with an unpopulated /etc/ for the first time it is
137 possible to configure the root user's password to be "systemd" like
138 this:
139
140 # systemd-nspawn --image=... --set-credential=passwd.hashed-password.root:'$y$j9T$yAuRJu1o5HioZAGDYPU5d.$F64ni6J2y2nNQve90M/p0ZP0ECP/qqzipNyaY9fjGpC' ...
141
142 Note again that the data specified in this credential is consulted only
143 when creating an account for the first time, it may not be used for
144 changing the password or shell of an account that already exists.
145
146 Use mkpasswd(1) for generating UNIX password hashes from the command
147 line.
148
150 On success, 0 is returned, a non-zero failure code otherwise.
151
153 systemd(1), sysusers.d(5), Users, Groups, UIDs and GIDs on systemd
154 systems[2], systemd.exec(1), mkpasswd(1)
155
157 1. Discoverable Partitions Specification
158 https://uapi-group.org/specifications/specs/discoverable_partitions_specification
159
160 2. Users, Groups, UIDs and GIDs on systemd systems
161 https://systemd.io/UIDS-GIDS
162
163
164
165systemd 253 SYSTEMD-SYSUSERS(8)