]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/sysusers.d.xml
tree-wide: remove Lennart's copyright lines
[thirdparty/systemd.git] / man / sysusers.d.xml
CommitLineData
21236ab5
LP
1<?xml version="1.0"?>
2<!--*-nxml-*-->
12b42c76 3<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
21236ab5 4<!--
572eb058 5 SPDX-License-Identifier: LGPL-2.1+
21236ab5 6-->
e6de49ab 7<refentry id="sysusers.d" conditional='ENABLE_SYSUSERS'
798d3a52
ZJS
8 xmlns:xi="http://www.w3.org/2001/XInclude">
9
10 <refentryinfo>
11 <title>sysusers.d</title>
12 <productname>systemd</productname>
13
14 <authorgroup>
15 <author>
16 <contrib>Developer</contrib>
17 <firstname>Lennart</firstname>
18 <surname>Poettering</surname>
19 <email>lennart@poettering.net</email>
20 </author>
21 </authorgroup>
22 </refentryinfo>
23
24 <refmeta>
25 <refentrytitle>sysusers.d</refentrytitle>
26 <manvolnum>5</manvolnum>
27 </refmeta>
28
29 <refnamediv>
30 <refname>sysusers.d</refname>
31 <refpurpose>Declarative allocation of system users and groups</refpurpose>
32 </refnamediv>
33
34 <refsynopsisdiv>
9b5c390f
YW
35 <para><filename>/etc/sysusers.d/*.conf</filename></para>
36 <para><filename>/run/sysusers.d/*.conf</filename></para>
798d3a52
ZJS
37 <para><filename>/usr/lib/sysusers.d/*.conf</filename></para>
38 </refsynopsisdiv>
39
40 <refsect1>
41 <title>Description</title>
42
7b1aaf66
ZJS
43 <para><command>systemd-sysusers</command> uses the files from
44 <filename>sysusers.d</filename> directory to create system users and groups and
45 to add users to groups, at package installation or boot time. This tool may be
46 used to allocate system users and groups only, it is not useful for creating
47 non-system (i.e. regular, "human") users and groups, as it accesses
48 <filename>/etc/passwd</filename> and <filename>/etc/group</filename> directly,
49 bypassing any more complex user databases, for example any database involving NIS
50 or LDAP.</para>
798d3a52
ZJS
51 </refsect1>
52
53 <refsect1>
8165be2e 54 <title>Configuration Directories and Precedence</title>
798d3a52
ZJS
55
56 <para>Each configuration file shall be named in the style of
57 <filename><replaceable>package</replaceable>.conf</filename> or
58 <filename><replaceable>package</replaceable>-<replaceable>part</replaceable>.conf</filename>.
59 The second variant should be used when it is desirable to make it
60 easy to override just this part of configuration.</para>
61
8165be2e
ZJS
62 <para>Files in <filename>/etc/sysusers.d</filename> override files
63 with the same name in <filename>/usr/lib/sysusers.d</filename> and
64 <filename>/run/sysusers.d</filename>. Files in
65 <filename>/run/sysusers.d</filename> override files with the same
66 name in <filename>/usr/lib/sysusers.d</filename>. Packages should
67 install their configuration files in
68 <filename>/usr/lib/sysusers.d</filename>. Files in
69 <filename>/etc/sysusers.d</filename> are reserved for the local
70 administrator, who may use this logic to override the
71 configuration files installed by vendor packages. All
72 configuration files are sorted by their filename in lexicographic
73 order, regardless of which of the directories they reside in. If
74 multiple files specify the same path, the entry in the file with
75 the lexicographically earliest name will be applied. All later
76 entries for the same user and group names will be logged as warnings.
77 </para>
78
79 <para>If the administrator wants to disable a configuration file
80 supplied by the vendor, the recommended way is to place a symlink
81 to <filename>/dev/null</filename> in
82 <filename>/etc/sysusers.d/</filename> bearing the same filename.
83 </para>
84 </refsect1>
85
86 <refsect1>
87 <title>Configuration File Format</title>
88
7b1aaf66
ZJS
89 <para>The file format is one line per user or group containing name, ID, GECOS
90 field description, home directory, and login shell:</para>
798d3a52 91
7b1aaf66
ZJS
92 <programlisting>#Type Name ID GECOS Home directory Shell
93u httpd 404 "HTTP User"
94u authd /usr/bin/authd "Authorization user"
95u postgres - "Postgresql Database" /var/lib/pgsql /usr/libexec/postgresdb
96g input - -
97m authd input
98u root 0 "Superuser" /root /bin/zsh</programlisting>
21236ab5 99
565dab8e
LP
100 <para>Empty lines and lines beginning with the <literal>#</literal> character are ignored, and may be used for
101 commenting.</para>
102
798d3a52
ZJS
103 <refsect2>
104 <title>Type</title>
105
106 <para>The type consists of a single letter. The following line
107 types are understood:</para>
108
109 <variablelist>
110 <varlistentry>
111 <term><varname>u</varname></term>
7b1aaf66
ZJS
112 <listitem><para>Create a system user and group of the specified name should
113 they not exist yet. The user's primary group will be set to the group
114 bearing the same name. The account will be created disabled, so that logins
115 are not allowed.</para></listitem>
798d3a52
ZJS
116 </varlistentry>
117
118 <varlistentry>
119 <term><varname>g</varname></term>
120 <listitem><para>Create a system group of the specified name
121 should it not exist yet. Note that <varname>u</varname>
122 implicitly create a matching group. The group will be
123 created with no password set.</para></listitem>
124 </varlistentry>
125
126 <varlistentry>
127 <term><varname>m</varname></term>
128 <listitem><para>Add a user to a group. If the user or group
cd72d204 129 do not exist yet, they will be implicitly
798d3a52
ZJS
130 created.</para></listitem>
131 </varlistentry>
132
133 <varlistentry>
134 <term><varname>r</varname></term>
135 <listitem><para>Add a range of numeric UIDs/GIDs to the pool
136 to allocate new UIDs and GIDs from. If no line of this type
b938cb90 137 is specified, the range of UIDs/GIDs is set to some
798d3a52
ZJS
138 compiled-in default. Note that both UIDs and GIDs are
139 allocated from the same pool, in order to ensure that users
140 and groups of the same name are likely to carry the same
141 numeric UID and GID.</para></listitem>
142 </varlistentry>
143
144 </variablelist>
145 </refsect2>
146
147 <refsect2>
148 <title>Name</title>
149
565dab8e
LP
150 <para>The name field specifies the user or group name. The specified name must consist only of the characters a-z,
151 A-Z, 0-9, <literal>_</literal> and <literal>-</literal>, except for the first character which must be one of a-z,
152 A-Z or <literal>_</literal> (i.e. numbers and <literal>-</literal> are not permitted as first character). The
153 user/group name must have at least one character, and at most 31.</para>
154
155 <para>It is strongly recommended to pick user and group names that are unlikely to clash with normal users
156 created by the administrator. A good scheme to guarantee this is by prefixing all system and group names with the
157 underscore, and avoiding too generic names.</para>
798d3a52 158
b938cb90 159 <para>For <varname>m</varname> lines, this field should contain
798d3a52
ZJS
160 the user name to add to a group.</para>
161
b938cb90 162 <para>For lines of type <varname>r</varname>, this field should
798d3a52
ZJS
163 be set to <literal>-</literal>.</para>
164 </refsect2>
165
166 <refsect2>
167 <title>ID</title>
168
b938cb90
JE
169 <para>For <varname>u</varname> and <varname>g</varname>, the
170 numeric 32-bit UID or GID of the user/group. Do not use IDs 65535
798d3a52
ZJS
171 or 4294967295, as they have special placeholder meanings.
172 Specify <literal>-</literal> for automatic UID/GID allocation
7b1aaf66
ZJS
173 for the user or group (this is strongly recommended unless it is strictly
174 necessary to use a specific UID or GID). Alternatively, specify an absolute path
b938cb90 175 in the file system. In this case, the UID/GID is read from the
798d3a52
ZJS
176 path's owner/group. This is useful to create users whose UID/GID
177 match the owners of pre-existing files (such as SUID or SGID
4cb41413
MV
178 binaries).
179 The syntax <literal><replaceable>uid</replaceable>:<replaceable>gid</replaceable></literal> is also supported to
1825c909
MV
180 allow creating user and group pairs with different numeric UID and GID values. The group with the indicated GID must get created explicitly before or it must already exist. Specifying <literal>-</literal> for the UID in this syntax
181 is also supported.
4cb41413 182 </para>
798d3a52 183
b938cb90 184 <para>For <varname>m</varname> lines, this field should contain
798d3a52
ZJS
185 the group name to add to a user to.</para>
186
b938cb90 187 <para>For lines of type <varname>r</varname>, this field should
798d3a52 188 be set to a UID/GID range in the format
b938cb90 189 <literal>FROM-TO</literal>, where both values are formatted as
798d3a52
ZJS
190 decimal ASCII numbers. Alternatively, a single UID/GID may be
191 specified formatted as decimal ASCII numbers.</para>
192 </refsect2>
193
194 <refsect2>
195 <title>GECOS</title>
196
7b1aaf66
ZJS
197 <para>A short, descriptive string for users to be created, enclosed in
198 quotation marks. Note that this field may not contain colons.</para>
798d3a52 199
7b1aaf66
ZJS
200 <para>Only applies to lines of type <varname>u</varname> and should otherwise
201 be left unset (or <literal>-</literal>).</para>
798d3a52
ZJS
202 </refsect2>
203
204 <refsect2>
205 <title>Home Directory</title>
206
7b1aaf66
ZJS
207 <para>The home directory for a new system user. If omitted, defaults to the
208 root directory.</para>
798d3a52 209
7b1aaf66
ZJS
210 <para>Only applies to lines of type <varname>u</varname> and should otherwise
211 be left unset (or <literal>-</literal>). It is recommended to omit this, unless
212 software strictly requires a home directory to be set.</para>
213 </refsect2>
214
215 <refsect2>
216 <title>Shell</title>
217
218 <para>The login shell of the user. If not specified, this will be set to
219 <filename>/sbin/nologin</filename>, except if the UID of the user is 0, in
220 which case <filename>/bin/sh</filename> will be used.</para>
221
222 <para>Only applies to lines of type <varname>u</varname> and should otherwise
223 be left unset (or <literal>-</literal>). It is recommended to omit this, unless
224 a shell different <filename>/sbin/nologin</filename> must be used.</para>
798d3a52 225 </refsect2>
798d3a52
ZJS
226 </refsect1>
227
33ab22fc
YW
228 <refsect1>
229 <title>Specifiers</title>
230
231 <para>Specifiers can be used in the "Name", "ID", "GECOS", "Home directory", and "Shell" fields.
232 An unknown or unresolvable specifier is treated as invalid configuration.
233 The following expansions are understood:</para>
234 <table>
235 <title>Specifiers available</title>
236 <tgroup cols='3' align='left' colsep='1' rowsep='1'>
237 <colspec colname="spec" />
238 <colspec colname="mean" />
239 <colspec colname="detail" />
240 <thead>
241 <row>
242 <entry>Specifier</entry>
243 <entry>Meaning</entry>
244 <entry>Details</entry>
245 </row>
246 </thead>
247 <tbody>
248 <row>
249 <entry><literal>%b</literal></entry>
250 <entry>Boot ID</entry>
251 <entry>The boot ID of the running system, formatted as string. See <citerefentry><refentrytitle>random</refentrytitle><manvolnum>4</manvolnum></citerefentry> for more information.</entry>
252 </row>
253 <row>
254 <entry><literal>%H</literal></entry>
255 <entry>Host name</entry>
256 <entry>The hostname of the running system.</entry>
257 </row>
258 <row>
259 <entry><literal>%m</literal></entry>
260 <entry>Machine ID</entry>
261 <entry>The machine ID of the running system, formatted as string. See <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry> for more information.</entry>
262 </row>
263 <row>
264 <entry><literal>%T</literal></entry>
265 <entry>Directory for temporary files</entry>
266 <entry>This is either <filename>/tmp</filename> or the path <literal>$TMPDIR</literal>, <literal>$TEMP</literal> or <literal>$TMP</literal> are set to.</entry>
267 </row>
268 <row>
269 <entry><literal>%v</literal></entry>
270 <entry>Kernel release</entry>
271 <entry>Identical to <command>uname -r</command> output.</entry>
272 </row>
273 <row>
274 <entry><literal>%V</literal></entry>
275 <entry>Directory for larger and persistent temporary files</entry>
276 <entry>This is either <filename>/var/tmp</filename> or the path <literal>$TMPDIR</literal>, <literal>$TEMP</literal> or <literal>$TMP</literal> are set to.</entry>
277 </row>
278 <row>
279 <entry><literal>%%</literal></entry>
280 <entry>Escaped <literal>%</literal></entry>
281 <entry>Single percent sign.</entry>
282 </row>
283 </tbody>
284 </tgroup>
285 </table>
286 </refsect1>
287
798d3a52
ZJS
288 <refsect1>
289 <title>Idempotence</title>
290
7b1aaf66
ZJS
291 <para>Note that <command>systemd-sysusers</command> will do nothing if the
292 specified users or groups already exist or the users are members of specified
293 groups, so normally there is no reason to override
294 <filename>sysusers.d</filename> vendor configuration, except to block certain
295 users or groups from being created.</para>
798d3a52
ZJS
296 </refsect1>
297
298 <refsect1>
299 <title>See Also</title>
300 <para>
301 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
302 <citerefentry><refentrytitle>systemd-sysusers</refentrytitle><manvolnum>8</manvolnum></citerefentry>
303 </para>
304 </refsect1>
21236ab5
LP
305
306</refentry>