1SYSUSERS.D(5)                     sysusers.d                     SYSUSERS.D(5)
2
3
4

NAME

6       sysusers.d - Declarative allocation of system users and groups
7

SYNOPSIS

9       /etc/sysusers.d/*.conf
10
11       /run/sysusers.d/*.conf
12
13       /usr/lib/sysusers.d/*.conf
14
15       #Type Name       ID                  GECOS              Home directory Shell
16       u     user_name  uid                 "User Description" /home/dir      /path/to/shell
17       u     user_name  uid:gid             "User Description" /home/dir      /path/to/shell
18       u     user_name  /file/owned/by/user "User Description" /home/dir      /path/to/shell
19       g     group_name gid
20       g     group_name /file/owned/by/group
21       m     user_name  group_name
22       r     -          lowest-highest
23

DESCRIPTION

25       systemd-sysusers uses the files from sysusers.d directory to create
26       system users and groups and to add users to groups, at package
27       installation or boot time. This tool may be used to allocate system
28       users and groups only, it is not useful for creating non-system (i.e.
29       regular, "human") users and groups, as it accesses /etc/passwd and
30       /etc/group directly, bypassing any more complex user databases, for
31       example any database involving NIS or LDAP.
32

CONFIGURATION DIRECTORIES AND PRECEDENCE

34       Each configuration file shall be named in the style of package.conf or
35       package-part.conf. The second variant should be used when it is
36       desirable to make it easy to override just this part of configuration.
37
38       Files in /etc/sysusers.d override files with the same name in
39       /usr/lib/sysusers.d and /run/sysusers.d. Files in /run/sysusers.d
40       override files with the same name in /usr/lib/sysusers.d. Packages
41       should install their configuration files in /usr/lib/sysusers.d. Files
42       in /etc/sysusers.d are reserved for the local administrator, who may
43       use this logic to override the configuration files installed by vendor
44       packages. All configuration files are sorted by their filename in
45       lexicographic order, regardless of which of the directories they reside
46       in. If multiple files specify the same path, the entry in the file with
47       the lexicographically earliest name will be applied. All later entries
48       for the same user and group names will be logged as warnings.
49
50       If the administrator wants to disable a configuration file supplied by
51       the vendor, the recommended way is to place a symlink to /dev/null in
52       /etc/sysusers.d/ bearing the same filename.
53

CONFIGURATION FILE FORMAT

55       The file format is one line per user or group containing name, ID,
56       GECOS field description, home directory, and login shell:
57
58           #Type Name     ID             GECOS                 Home directory Shell
59           u     httpd    404            "HTTP User"
60           u     _authd   /usr/bin/authd "Authorization user"
61           u     postgres -              "Postgresql Database" /var/lib/pgsql /usr/libexec/postgresdb
62           g     input    -              -
63           m     _authd   input
64           u     root     0              "Superuser"           /root          /bin/zsh
65           r     -        500-900
66
67       Empty lines and lines beginning with the "#" character are ignored, and
68       may be used for commenting.
69
70   Type
71       The type consists of a single letter. The following line types are
72       understood:
73
74       u
75           Create a system user and group of the specified name should they
76           not exist yet. The user's primary group will be set to the group
77           bearing the same name unless the ID field specifies it. The account
78           will be created disabled, so that logins are not allowed.
79
80       g
81           Create a system group of the specified name should it not exist
82           yet. Note that u implicitly creates a matching group. The group
83           will be created with no password set.
84
85       m
86           Add a user to a group. If the user or group do not exist yet, they
87           will be implicitly created.
88
89       r
90           Add a range of numeric UIDs/GIDs to the pool to allocate new UIDs
91           and GIDs from. If no line of this type is specified, the range of
92           UIDs/GIDs is set to some compiled-in default. Note that both UIDs
93           and GIDs are allocated from the same pool, in order to ensure that
94           users and groups of the same name are likely to carry the same
95           numeric UID and GID.
96
97   Name
98       The name field specifies the user or group name. The specified name
99       must consist only of the characters a-z, A-Z, 0-9, "_" and "-", except
100       for the first character which must be one of a-z, A-Z or "_" (i.e.
101       numbers and "-" are not permitted as first character). The user/group
102       name must have at least one character, and at most 31.
103
104       For further details about the syntax of user/group names, see
105       User/Group Name Syntax[1].
106
107       It is strongly recommended to pick user and group names that are
108       unlikely to clash with normal users created by the administrator. A
109       good scheme to guarantee this is by prefixing all system and group
110       names with the underscore, and avoiding too generic names.
111
112       For m lines, this field should contain the user name to add to a group.
113
114       For lines of type r, this field should be set to "-".
115
116   ID
117       For u and g, the numeric 32-bit UID or GID of the user/group. Do not
118       use IDs 65535 or 4294967295, as they have special placeholder meanings.
119       Specify "-" for automatic UID/GID allocation for the user or group
120       (this is strongly recommended unless it is strictly necessary to use a
121       specific UID or GID). Alternatively, specify an absolute path in the
122       file system. In this case, the UID/GID is read from the path's
123       owner/group. This is useful to create users whose UID/GID match the
124       owners of pre-existing files (such as SUID or SGID binaries). The
125       syntaxes "uid:gid" and "uid:groupname" are supported to allow creating
126       users with specific primary groups. The given group must be created
127       explicitly, or it must already exist. Specifying "-" for the UID in
128       these syntaxes is also supported.
129
130       For m lines, this field should contain the group name to add to a user
131       to.
132
133       For lines of type r, this field should be set to a UID/GID range in the
134       format "FROM-TO", where both values are formatted as decimal ASCII
135       numbers. Alternatively, a single UID/GID may be specified formatted as
136       decimal ASCII numbers.
137
138   GECOS
139       A short, descriptive string for users to be created, enclosed in
140       quotation marks. Note that this field may not contain colons.
141
142       Only applies to lines of type u and should otherwise be left unset (or
143       "-").
144
145   Home Directory
146       The home directory for a new system user. If omitted, defaults to the
147       root directory.
148
149       Only applies to lines of type u and should otherwise be left unset (or
150       "-"). It is recommended to omit this, unless software strictly requires
151       a home directory to be set.
152
153       systemd-sysusers only sets the home directory record in the user
154       database. To actually create the directory, consider adding a
155       corresponding tmpfiles.d(5) fragment.
156
157   Shell
158       The login shell of the user. If not specified, this will be set to
159       /usr/sbin/nologin, except if the UID of the user is 0, in which case
160       /bin/sh will be used.
161
162       Only applies to lines of type u and should otherwise be left unset (or
163       "-"). It is recommended to omit this, unless a shell different
164       /usr/sbin/nologin must be used.
165

SPECIFIERS

167       Specifiers can be used in the "Name", "ID", "GECOS", "Home directory",
168       and "Shell" fields. An unknown or unresolvable specifier is treated as
169       invalid configuration. The following expansions are understood:
170
171       Table 1. Specifiers available
172       ┌──────────┬─────────────────────┬────────────────────────┐
173Specifier Meaning             Details                
174       ├──────────┼─────────────────────┼────────────────────────┤
175       │"%a"      │ Architecture        │ A short string         │
176       │          │                     │ identifying the        │
177       │          │                     │ architecture of the    │
178       │          │                     │ local system. A        │
179       │          │                     │ string such as x86,    │
180       │          │                     │ x86-64 or arm64.       │
181       │          │                     │ See the                │
182       │          │                     │ architectures          │
183       │          │                     │ defined for            │
184       │          │                     │ ConditionArchitecture=
185       │          │                     │ in systemd.unit(5)
186       │          │                     │ for a full list.       │
187       ├──────────┼─────────────────────┼────────────────────────┤
188       │"%A"      │ Operating system    │ The operating system   │
189       │          │ image version       │ image version          │
190       │          │                     │ identifier of the      │
191       │          │                     │ running system, as     │
192       │          │                     │ read from the          │
193       │          │                     │ IMAGE_VERSION= field   │
194       │          │                     │ of /etc/os-release. If │
195       │          │                     │ not set, resolves to   │
196       │          │                     │ an empty string. See   │
197       │          │                     │ os-release(5) for more │
198       │          │                     │ information.           │
199       ├──────────┼─────────────────────┼────────────────────────┤
200       │"%b"      │ Boot ID             │ The boot ID of the     │
201       │          │                     │ running system,        │
202       │          │                     │ formatted as string.   │
203       │          │                     │ See random(4) for more │
204       │          │                     │ information.           │
205       ├──────────┼─────────────────────┼────────────────────────┤
206       │"%B"      │ Operating system    │ The operating system   │
207       │          │ build ID            │ build identifier of    │
208       │          │                     │ the running system, as │
209       │          │                     │ read from the          │
210       │          │                     │ BUILD_ID= field of     │
211       │          │                     │ /etc/os-release. If    │
212       │          │                     │ not set, resolves to   │
213       │          │                     │ an empty string. See   │
214       │          │                     │ os-release(5) for more │
215       │          │                     │ information.           │
216       ├──────────┼─────────────────────┼────────────────────────┤
217       │"%H"      │ Host name           │ The hostname of the    │
218       │          │                     │ running system.        │
219       ├──────────┼─────────────────────┼────────────────────────┤
220       │"%l"      │ Short host name     │ The hostname of the    │
221       │          │                     │ running system,        │
222       │          │                     │ truncated at the first │
223       │          │                     │ dot to remove any      │
224       │          │                     │ domain component.      │
225       ├──────────┼─────────────────────┼────────────────────────┤
226       │"%m"      │ Machine ID          │ The machine ID of the  │
227       │          │                     │ running system,        │
228       │          │                     │ formatted as string.   │
229       │          │                     │ See machine-id(5) for  │
230       │          │                     │ more information.      │
231       ├──────────┼─────────────────────┼────────────────────────┤
232       │"%M"      │ Operating system    │ The operating system   │
233       │          │ image identifier    │ image identifier of    │
234       │          │                     │ the running system, as │
235       │          │                     │ read from the          │
236       │          │                     │ IMAGE_ID= field of     │
237       │          │                     │ /etc/os-release. If    │
238       │          │                     │ not set, resolves to   │
239       │          │                     │ an empty string. See   │
240       │          │                     │ os-release(5) for more │
241       │          │                     │ information.           │
242       ├──────────┼─────────────────────┼────────────────────────┤
243       │"%o"      │ Operating system ID │ The operating system   │
244       │          │                     │ identifier of the      │
245       │          │                     │ running system, as     │
246       │          │                     │ read from the ID=
247       │          │                     │ field of               │
248       │          │                     │ /etc/os-release. See   │
249       │          │                     │ os-release(5) for more │
250       │          │                     │ information.           │
251       ├──────────┼─────────────────────┼────────────────────────┤
252       │"%T"      │ Directory for       │ This is either /tmp or │
253       │          │ temporary files     │ the path "$TMPDIR",    │
254       │          │                     │ "$TEMP" or "$TMP" are  │
255       │          │                     │ set to. (Note that the │
256       │          │                     │ directory may be       │
257       │          │                     │ specified without a    │
258       │          │                     │ trailing slash.)       │
259       ├──────────┼─────────────────────┼────────────────────────┤
260       │"%v"      │ Kernel release      │ Identical to uname -r  
261       │          │                     │ output.                │
262       ├──────────┼─────────────────────┼────────────────────────┤
263       │"%V"      │ Directory for       │ This is either         │
264       │          │ larger and          │ /var/tmp or the path   │
265       │          │ persistent          │ "$TMPDIR", "$TEMP" or  │
266       │          │ temporary files     │ "$TMP" are set to.     │
267       │          │                     │ (Note that the         │
268       │          │                     │ directory may be       │
269       │          │                     │ specified without a    │
270       │          │                     │ trailing slash.)       │
271       ├──────────┼─────────────────────┼────────────────────────┤
272       │"%w"      │ Operating system    │ The operating system   │
273       │          │ version ID          │ version identifier of  │
274       │          │                     │ the running system, as │
275       │          │                     │ read from the          │
276       │          │                     │ VERSION_ID= field of   │
277       │          │                     │ /etc/os-release. If    │
278       │          │                     │ not set, resolves to   │
279       │          │                     │ an empty string. See   │
280       │          │                     │ os-release(5) for more │
281       │          │                     │ information.           │
282       ├──────────┼─────────────────────┼────────────────────────┤
283       │"%W"      │ Operating system    │ The operating system   │
284       │          │ variant ID          │ variant identifier of  │
285       │          │                     │ the running system, as │
286       │          │                     │ read from the          │
287       │          │                     │ VARIANT_ID= field of   │
288       │          │                     │ /etc/os-release. If    │
289       │          │                     │ not set, resolves to   │
290       │          │                     │ an empty string. See   │
291       │          │                     │ os-release(5) for more │
292       │          │                     │ information.           │
293       ├──────────┼─────────────────────┼────────────────────────┤
294       │"%%"      │ Single percent sign │ Use "%%" in place of   │
295       │          │                     │ "%" to specify a       │
296       │          │                     │ single percent sign.   │
297       └──────────┴─────────────────────┴────────────────────────┘
298

IDEMPOTENCE

300       Note that systemd-sysusers will do nothing if the specified users or
301       groups already exist or the users are members of specified groups, so
302       normally there is no reason to override sysusers.d vendor
303       configuration, except to block certain users or groups from being
304       created.
305

SEE ALSO

307       systemd(1), systemd-sysusers(8)
308

NOTES

310        1. User/Group Name Syntax
311           https://systemd.io/USER_NAMES
312
313
314
315systemd 250                                                      SYSUSERS.D(5)
Impressum