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       │"%b"      │ Boot ID             │ The boot ID of the     │
189       │          │                     │ running system,        │
190       │          │                     │ formatted as string.   │
191       │          │                     │ See random(4) for more │
192       │          │                     │ information.           │
193       ├──────────┼─────────────────────┼────────────────────────┤
194       │"%B"      │ Operating system    │ The operating system   │
195       │          │ build ID            │ build identifier of    │
196       │          │                     │ the running system, as │
197       │          │                     │ read from the          │
198       │          │                     │ BUILD_ID= field of     │
199       │          │                     │ /etc/os-release. If    │
200       │          │                     │ not set, resolves to   │
201       │          │                     │ an empty string. See   │
202       │          │                     │ os-release(5) for more │
203       │          │                     │ information.           │
204       ├──────────┼─────────────────────┼────────────────────────┤
205       │"%H"      │ Host name           │ The hostname of the    │
206       │          │                     │ running system.        │
207       ├──────────┼─────────────────────┼────────────────────────┤
208       │"%l"      │ Short host name     │ The hostname of the    │
209       │          │                     │ running system,        │
210       │          │                     │ truncated at the first │
211       │          │                     │ dot to remove any      │
212       │          │                     │ domain component.      │
213       ├──────────┼─────────────────────┼────────────────────────┤
214       │"%m"      │ Machine ID          │ The machine ID of the  │
215       │          │                     │ running system,        │
216       │          │                     │ formatted as string.   │
217       │          │                     │ See machine-id(5) for  │
218       │          │                     │ more information.      │
219       ├──────────┼─────────────────────┼────────────────────────┤
220       │"%o"      │ Operating system ID │ The operating system   │
221       │          │                     │ identifier of the      │
222       │          │                     │ running system, as     │
223       │          │                     │ read from the ID=
224       │          │                     │ field of               │
225       │          │                     │ /etc/os-release. See   │
226       │          │                     │ os-release(5) for more │
227       │          │                     │ information.           │
228       ├──────────┼─────────────────────┼────────────────────────┤
229       │"%T"      │ Directory for       │ This is either /tmp or │
230       │          │ temporary files     │ the path "$TMPDIR",    │
231       │          │                     │ "$TEMP" or "$TMP" are  │
232       │          │                     │ set to. (Note that the │
233       │          │                     │ directory may be       │
234       │          │                     │ specified without a    │
235       │          │                     │ trailing slash.)       │
236       ├──────────┼─────────────────────┼────────────────────────┤
237       │"%v"      │ Kernel release      │ Identical to uname -r  
238       │          │                     │ output.                │
239       ├──────────┼─────────────────────┼────────────────────────┤
240       │"%V"      │ Directory for       │ This is either         │
241       │          │ larger and          │ /var/tmp or the path   │
242       │          │ persistent          │ "$TMPDIR", "$TEMP" or  │
243       │          │ temporary files     │ "$TMP" are set to.     │
244       │          │                     │ (Note that the         │
245       │          │                     │ directory may be       │
246       │          │                     │ specified without a    │
247       │          │                     │ trailing slash.)       │
248       ├──────────┼─────────────────────┼────────────────────────┤
249       │"%w"      │ Operating system    │ The operating system   │
250       │          │ version ID          │ version identifier of  │
251       │          │                     │ the running system, as │
252       │          │                     │ read from the          │
253       │          │                     │ VERSION_ID= field of   │
254       │          │                     │ /etc/os-release. If    │
255       │          │                     │ not set, resolves to   │
256       │          │                     │ an empty string. See   │
257       │          │                     │ os-release(5) for more │
258       │          │                     │ information.           │
259       ├──────────┼─────────────────────┼────────────────────────┤
260       │"%W"      │ Operating system    │ The operating system   │
261       │          │ variant ID          │ variant identifier of  │
262       │          │                     │ the running system, as │
263       │          │                     │ read from the          │
264       │          │                     │ VARIANT_ID= field of   │
265       │          │                     │ /etc/os-release. If    │
266       │          │                     │ not set, resolves to   │
267       │          │                     │ an empty string. See   │
268       │          │                     │ os-release(5) for more │
269       │          │                     │ information.           │
270       ├──────────┼─────────────────────┼────────────────────────┤
271       │"%%"      │ Single percent sign │ Use "%%" in place of   │
272       │          │                     │ "%" to specify a       │
273       │          │                     │ single percent sign.   │
274       └──────────┴─────────────────────┴────────────────────────┘
275

IDEMPOTENCE

277       Note that systemd-sysusers will do nothing if the specified users or
278       groups already exist or the users are members of specified groups, so
279       normally there is no reason to override sysusers.d vendor
280       configuration, except to block certain users or groups from being
281       created.
282

SEE ALSO

284       systemd(1), systemd-sysusers(8)
285

NOTES

287        1. User/Group Name Syntax
288           https://systemd.io/USER_NAMES
289
290
291
292systemd 248                                                      SYSUSERS.D(5)
Impressum