1SYSUSERS.D(5) sysusers.d SYSUSERS.D(5)
2
3
4
6 sysusers.d - Declarative allocation of system users and groups
7
9 /etc/sysusers.d/*.conf
10
11 /run/sysusers.d/*.conf
12
13 /usr/lib/sysusers.d/*.conf
14
16 systemd-sysusers uses the files from sysusers.d directory to create
17 system users and groups and to add users to groups, at package
18 installation or boot time. This tool may be used to allocate system
19 users and groups only, it is not useful for creating non-system (i.e.
20 regular, "human") users and groups, as it accesses /etc/passwd and
21 /etc/group directly, bypassing any more complex user databases, for
22 example any database involving NIS or LDAP.
23
25 Each configuration file shall be named in the style of package.conf or
26 package-part.conf. The second variant should be used when it is
27 desirable to make it easy to override just this part of configuration.
28
29 Files in /etc/sysusers.d override files with the same name in
30 /usr/lib/sysusers.d and /run/sysusers.d. Files in /run/sysusers.d
31 override files with the same name in /usr/lib/sysusers.d. Packages
32 should install their configuration files in /usr/lib/sysusers.d. Files
33 in /etc/sysusers.d are reserved for the local administrator, who may
34 use this logic to override the configuration files installed by vendor
35 packages. All configuration files are sorted by their filename in
36 lexicographic order, regardless of which of the directories they reside
37 in. If multiple files specify the same path, the entry in the file with
38 the lexicographically earliest name will be applied. All later entries
39 for the same user and group names will be logged as warnings.
40
41 If the administrator wants to disable a configuration file supplied by
42 the vendor, the recommended way is to place a symlink to /dev/null in
43 /etc/sysusers.d/ bearing the same filename.
44
46 The file format is one line per user or group containing name, ID,
47 GECOS field description, home directory, and login shell:
48
49 #Type Name ID GECOS Home directory Shell
50 u httpd 404 "HTTP User"
51 u authd /usr/bin/authd "Authorization user"
52 u postgres - "Postgresql Database" /var/lib/pgsql /usr/libexec/postgresdb
53 g input - -
54 m authd input
55 u root 0 "Superuser" /root /bin/zsh
56
57 Empty lines and lines beginning with the "#" character are ignored, and
58 may be used for commenting.
59
60 Type
61 The type consists of a single letter. The following line types are
62 understood:
63
64 u
65 Create a system user and group of the specified name should they
66 not exist yet. The user's primary group will be set to the group
67 bearing the same name. The account will be created disabled, so
68 that logins are not allowed.
69
70 g
71 Create a system group of the specified name should it not exist
72 yet. Note that u implicitly create a matching group. The group will
73 be created with no password set.
74
75 m
76 Add a user to a group. If the user or group do not exist yet, they
77 will be implicitly created.
78
79 r
80 Add a range of numeric UIDs/GIDs to the pool to allocate new UIDs
81 and GIDs from. If no line of this type is specified, the range of
82 UIDs/GIDs is set to some compiled-in default. Note that both UIDs
83 and GIDs are allocated from the same pool, in order to ensure that
84 users and groups of the same name are likely to carry the same
85 numeric UID and GID.
86
87 Name
88 The name field specifies the user or group name. The specified name
89 must consist only of the characters a-z, A-Z, 0-9, "_" and "-", except
90 for the first character which must be one of a-z, A-Z or "_" (i.e.
91 numbers and "-" are not permitted as first character). The user/group
92 name must have at least one character, and at most 31.
93
94 It is strongly recommended to pick user and group names that are
95 unlikely to clash with normal users created by the administrator. A
96 good scheme to guarantee this is by prefixing all system and group
97 names with the underscore, and avoiding too generic names.
98
99 For m lines, this field should contain the user name to add to a group.
100
101 For lines of type r, this field should be set to "-".
102
103 ID
104 For u and g, the numeric 32-bit UID or GID of the user/group. Do not
105 use IDs 65535 or 4294967295, as they have special placeholder meanings.
106 Specify "-" for automatic UID/GID allocation for the user or group
107 (this is strongly recommended unless it is strictly necessary to use a
108 specific UID or GID). Alternatively, specify an absolute path in the
109 file system. In this case, the UID/GID is read from the path's
110 owner/group. This is useful to create users whose UID/GID match the
111 owners of pre-existing files (such as SUID or SGID binaries). The
112 syntax "uid:gid" is also supported to allow creating user and group
113 pairs with different numeric UID and GID values. The group with the
114 indicated GID must get created explicitly before or it must already
115 exist. Specifying "-" for the UID in this syntax is also supported.
116
117 For m lines, this field should contain the group name to add to a user
118 to.
119
120 For lines of type r, this field should be set to a UID/GID range in the
121 format "FROM-TO", where both values are formatted as decimal ASCII
122 numbers. Alternatively, a single UID/GID may be specified formatted as
123 decimal ASCII numbers.
124
125 GECOS
126 A short, descriptive string for users to be created, enclosed in
127 quotation marks. Note that this field may not contain colons.
128
129 Only applies to lines of type u and should otherwise be left unset (or
130 "-").
131
132 Home Directory
133 The home directory for a new system user. If omitted, defaults to the
134 root directory.
135
136 Only applies to lines of type u and should otherwise be left unset (or
137 "-"). It is recommended to omit this, unless software strictly requires
138 a home directory to be set.
139
140 Shell
141 The login shell of the user. If not specified, this will be set to
142 /sbin/nologin, except if the UID of the user is 0, in which case
143 /bin/sh will be used.
144
145 Only applies to lines of type u and should otherwise be left unset (or
146 "-"). It is recommended to omit this, unless a shell different
147 /sbin/nologin must be used.
148
150 Specifiers can be used in the "Name", "ID", "GECOS", "Home directory",
151 and "Shell" fields. An unknown or unresolvable specifier is treated as
152 invalid configuration. The following expansions are understood:
153
154 Table 1. Specifiers available
155 ┌──────────┬─────────────────┬─────────────────────┐
156 │Specifier │ Meaning │ Details │
157 ├──────────┼─────────────────┼─────────────────────┤
158 │"%b" │ Boot ID │ The boot ID of the │
159 │ │ │ running system, │
160 │ │ │ formatted as │
161 │ │ │ string. See │
162 │ │ │ random(4) for more │
163 │ │ │ information. │
164 ├──────────┼─────────────────┼─────────────────────┤
165 │"%H" │ Host name │ The hostname of the │
166 │ │ │ running system. │
167 ├──────────┼─────────────────┼─────────────────────┤
168 │"%m" │ Machine ID │ The machine ID of │
169 │ │ │ the running system, │
170 │ │ │ formatted as │
171 │ │ │ string. See │
172 │ │ │ machine-id(5) for │
173 │ │ │ more information. │
174 ├──────────┼─────────────────┼─────────────────────┤
175 │"%T" │ Directory for │ This is either /tmp │
176 │ │ temporary files │ or the path │
177 │ │ │ "$TMPDIR", "$TEMP" │
178 │ │ │ or "$TMP" are set │
179 │ │ │ to. │
180 ├──────────┼─────────────────┼─────────────────────┤
181 │"%v" │ Kernel release │ Identical to uname │
182 │ │ │ -r output. │
183 ├──────────┼─────────────────┼─────────────────────┤
184 │"%V" │ Directory for │ This is either │
185 │ │ larger and │ /var/tmp or the │
186 │ │ persistent │ path "$TMPDIR", │
187 │ │ temporary files │ "$TEMP" or "$TMP" │
188 │ │ │ are set to. │
189 ├──────────┼─────────────────┼─────────────────────┤
190 │"%%" │ Escaped "%" │ Single percent │
191 │ │ │ sign. │
192 └──────────┴─────────────────┴─────────────────────┘
193
195 Note that systemd-sysusers will do nothing if the specified users or
196 groups already exist or the users are members of specified groups, so
197 normally there is no reason to override sysusers.d vendor
198 configuration, except to block certain users or groups from being
199 created.
200
202 systemd(1), systemd-sysusers(8)
203
204
205
206systemd 241 SYSUSERS.D(5)