1SYSTEMD-SYSUSERS(8)            systemd-sysusers            SYSTEMD-SYSUSERS(8)
2
3
4

NAME

6       systemd-sysusers, systemd-sysusers.service - Allocate system users and
7       groups
8

SYNOPSIS

10       systemd-sysusers [OPTIONS...] [CONFIGFILE...]
11
12       systemd-sysusers.service
13

DESCRIPTION

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

OPTIONS

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       --image-policy=policy
49           Takes an image policy string as argument, as per systemd.image-
50           policy(7). The policy is enforced when operating on the disk image
51           specified via --image=, see above. If not specified defaults to the
52           "*" policy, i.e. all recognized file systems in the image are used.
53
54       --replace=PATH
55           When this option is given, one or more positional arguments must be
56           specified. All configuration files found in the directories listed
57           in sysusers.d(5) will be read, and the configuration given on the
58           command line will be handled instead of and with the same priority
59           as the configuration file PATH.
60
61           This option is intended to be used when package installation
62           scripts are running and files belonging to that package are not yet
63           available on disk, so their contents must be given on the command
64           line, but the admin configuration might already exist and should be
65           given higher priority.
66
67           Example 1. RPM installation script for radvd
68
69               echo 'u radvd - "radvd daemon"' | \
70                         systemd-sysusers --replace=/usr/lib/sysusers.d/radvd.conf -
71
72           This will create the radvd user as if
73           /usr/lib/sysusers.d/radvd.conf was already on disk. An admin might
74           override the configuration specified on the command line by placing
75           /etc/sysusers.d/radvd.conf or even
76           /etc/sysusers.d/00-overrides.conf.
77
78           Note that this is the expanded form, and when used in a package,
79           this would be written using a macro with "radvd" and a file
80           containing the configuration line as arguments.
81
82       --dry-run
83           Process the configuration and figure out what entries would be
84           created, but don't actually write anything.
85
86       --inline
87           Treat each positional argument as a separate configuration line
88           instead of a file name.
89
90       --cat-config
91           Copy the contents of config files to standard output. Before each
92           file, the filename is printed as a comment.
93
94       --no-pager
95           Do not pipe output into a pager.
96
97       -h, --help
98           Print a short help text and exit.
99
100       --version
101           Print a short version string and exit.
102

CREDENTIALS

104       systemd-sysusers supports the service credentials logic as implemented
105       by ImportCredential=LoadCredential=/SetCredential= (see systemd.exec(1)
106       for details). The following credentials are used when passed in:
107
108       passwd.hashed-password.user
109           A UNIX hashed password string to use for the specified user, when
110           creating an entry for it. This is particularly useful for the
111           "root" user as it allows provisioning the default root password to
112           use via a unit file drop-in or from a container manager passing in
113           this credential. Note that setting this credential has no effect if
114           the specified user account already exists. This credential is hence
115           primarily useful in first boot scenarios or systems that are fully
116           stateless and come up with an empty /etc/ on every boot.
117
118       passwd.plaintext-password.user
119           Similar to "passwd.hashed-password.user" but expect a literal,
120           plaintext password, which is then automatically hashed before used
121           for the user account. If both the hashed and the plaintext
122           credential are specified for the same user the former takes
123           precedence. It's generally recommended to specify the hashed
124           version; however in test environments with weaker requirements on
125           security it might be easier to pass passwords in plaintext instead.
126
127       passwd.shell.user
128           Specifies the shell binary to use for the specified account when
129           creating it.
130
131       sysusers.extra
132           The contents of this credential may contain additional lines to
133           operate on. The credential contents should follow the same format
134           as any other sysusers.d/ drop-in. If this credential is passed it
135           is processed after all of the drop-in files read from the file
136           system.
137
138       Note that by default the systemd-sysusers.service unit file is set up
139       to inherit the "passwd.hashed-password.root",
140       "passwd.plaintext-password.root", "passwd.shell.root" and
141       "sysusers.extra" credentials from the service manager. Thus, when
142       invoking a container with an unpopulated /etc/ for the first time it is
143       possible to configure the root user's password to be "systemd" like
144       this:
145
146           # systemd-nspawn --image=... --set-credential=passwd.hashed-password.root:'$y$j9T$yAuRJu1o5HioZAGDYPU5d.$F64ni6J2y2nNQve90M/p0ZP0ECP/qqzipNyaY9fjGpC' ...
147
148       Note again that the data specified in this credential is consulted only
149       when creating an account for the first time, it may not be used for
150       changing the password or shell of an account that already exists.
151
152       Use mkpasswd(1) for generating UNIX password hashes from the command
153       line.
154

EXIT STATUS

156       On success, 0 is returned, a non-zero failure code otherwise.
157

SEE ALSO

159       systemd(1), sysusers.d(5), Users, Groups, UIDs and GIDs on systemd
160       systems[2], systemd.exec(1), mkpasswd(1)
161

NOTES

163        1. Discoverable Partitions Specification
164           https://uapi-group.org/specifications/specs/discoverable_partitions_specification
165
166        2. Users, Groups, UIDs and GIDs on systemd systems
167           https://systemd.io/UIDS-GIDS
168
169
170
171systemd 254                                                SYSTEMD-SYSUSERS(8)
Impressum