]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/sysusers.d.xml
final v236 update (#7649)
[thirdparty/systemd.git] / man / sysusers.d.xml
1 <?xml version="1.0"?>
2 <!--*-nxml-*-->
3 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4 <!--
5 SPDX-License-Identifier: LGPL-2.1+
6
7 This file is part of systemd.
8
9 Copyright 2014 Lennart Poettering
10
11 systemd is free software; you can redistribute it and/or modify it
12 under the terms of the GNU Lesser General Public License as published by
13 the Free Software Foundation; either version 2.1 of the License, or
14 (at your option) any later version.
15
16 systemd is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Lesser General Public License for more details.
20
21 You should have received a copy of the GNU Lesser General Public License
22 along with systemd; If not, see <http://www.gnu.org/licenses/>.
23 -->
24 <refentry id="sysusers.d" conditional='ENABLE_SYSUSERS'
25 xmlns:xi="http://www.w3.org/2001/XInclude">
26
27 <refentryinfo>
28 <title>sysusers.d</title>
29 <productname>systemd</productname>
30
31 <authorgroup>
32 <author>
33 <contrib>Developer</contrib>
34 <firstname>Lennart</firstname>
35 <surname>Poettering</surname>
36 <email>lennart@poettering.net</email>
37 </author>
38 </authorgroup>
39 </refentryinfo>
40
41 <refmeta>
42 <refentrytitle>sysusers.d</refentrytitle>
43 <manvolnum>5</manvolnum>
44 </refmeta>
45
46 <refnamediv>
47 <refname>sysusers.d</refname>
48 <refpurpose>Declarative allocation of system users and groups</refpurpose>
49 </refnamediv>
50
51 <refsynopsisdiv>
52 <para><filename>/etc/sysusers.d/*.conf</filename></para>
53 <para><filename>/run/sysusers.d/*.conf</filename></para>
54 <para><filename>/usr/lib/sysusers.d/*.conf</filename></para>
55 </refsynopsisdiv>
56
57 <refsect1>
58 <title>Description</title>
59
60 <para><command>systemd-sysusers</command> uses the files from <filename>sysusers.d</filename> directory to create
61 system users and groups at package installation or boot time. This tool may be used to allocate system users and
62 groups only, it is not useful for creating non-system (i.e. regular, "human") users and groups, as it accesses
63 <filename>/etc/passwd</filename> and <filename>/etc/group</filename> directly, bypassing any more complex user
64 databases, for example any database involving NIS or LDAP.</para>
65 </refsect1>
66
67 <refsect1>
68 <title>Configuration Directories and Precedence</title>
69
70 <para>Each configuration file shall be named in the style of
71 <filename><replaceable>package</replaceable>.conf</filename> or
72 <filename><replaceable>package</replaceable>-<replaceable>part</replaceable>.conf</filename>.
73 The second variant should be used when it is desirable to make it
74 easy to override just this part of configuration.</para>
75
76 <para>Files in <filename>/etc/sysusers.d</filename> override files
77 with the same name in <filename>/usr/lib/sysusers.d</filename> and
78 <filename>/run/sysusers.d</filename>. Files in
79 <filename>/run/sysusers.d</filename> override files with the same
80 name in <filename>/usr/lib/sysusers.d</filename>. Packages should
81 install their configuration files in
82 <filename>/usr/lib/sysusers.d</filename>. Files in
83 <filename>/etc/sysusers.d</filename> are reserved for the local
84 administrator, who may use this logic to override the
85 configuration files installed by vendor packages. All
86 configuration files are sorted by their filename in lexicographic
87 order, regardless of which of the directories they reside in. If
88 multiple files specify the same path, the entry in the file with
89 the lexicographically earliest name will be applied. All later
90 entries for the same user and group names will be logged as warnings.
91 </para>
92
93 <para>If the administrator wants to disable a configuration file
94 supplied by the vendor, the recommended way is to place a symlink
95 to <filename>/dev/null</filename> in
96 <filename>/etc/sysusers.d/</filename> bearing the same filename.
97 </para>
98 </refsect1>
99
100 <refsect1>
101 <title>Configuration File Format</title>
102
103 <para>The file format is one line per user or group containing
104 name, ID, GECOS field description and home directory:</para>
105
106 <programlisting>#Type Name ID GECOS Home directory
107 u httpd 440 "HTTP User"
108 u authd /usr/bin/authd "Authorization user"
109 g input - -
110 m authd input
111 u root 0 "Superuser" /root</programlisting>
112
113 <para>Empty lines and lines beginning with the <literal>#</literal> character are ignored, and may be used for
114 commenting.</para>
115
116 <refsect2>
117 <title>Type</title>
118
119 <para>The type consists of a single letter. The following line
120 types are understood:</para>
121
122 <variablelist>
123 <varlistentry>
124 <term><varname>u</varname></term>
125 <listitem><para>Create a system user and group of the
126 specified name should they not exist yet. The user's primary
127 group will be set to the group bearing the same name. The
128 user's shell will be set to
129 <filename>/sbin/nologin</filename>, the home directory to
130 the specified home directory, or <filename>/</filename> if
131 none is given. The account will be created disabled, so that
132 logins are not allowed.</para></listitem>
133 </varlistentry>
134
135 <varlistentry>
136 <term><varname>g</varname></term>
137 <listitem><para>Create a system group of the specified name
138 should it not exist yet. Note that <varname>u</varname>
139 implicitly create a matching group. The group will be
140 created with no password set.</para></listitem>
141 </varlistentry>
142
143 <varlistentry>
144 <term><varname>m</varname></term>
145 <listitem><para>Add a user to a group. If the user or group
146 do not exist yet, they will be implicitly
147 created.</para></listitem>
148 </varlistentry>
149
150 <varlistentry>
151 <term><varname>r</varname></term>
152 <listitem><para>Add a range of numeric UIDs/GIDs to the pool
153 to allocate new UIDs and GIDs from. If no line of this type
154 is specified, the range of UIDs/GIDs is set to some
155 compiled-in default. Note that both UIDs and GIDs are
156 allocated from the same pool, in order to ensure that users
157 and groups of the same name are likely to carry the same
158 numeric UID and GID.</para></listitem>
159 </varlistentry>
160
161 </variablelist>
162 </refsect2>
163
164 <refsect2>
165 <title>Name</title>
166
167 <para>The name field specifies the user or group name. The specified name must consist only of the characters a-z,
168 A-Z, 0-9, <literal>_</literal> and <literal>-</literal>, except for the first character which must be one of a-z,
169 A-Z or <literal>_</literal> (i.e. numbers and <literal>-</literal> are not permitted as first character). The
170 user/group name must have at least one character, and at most 31.</para>
171
172 <para>It is strongly recommended to pick user and group names that are unlikely to clash with normal users
173 created by the administrator. A good scheme to guarantee this is by prefixing all system and group names with the
174 underscore, and avoiding too generic names.</para>
175
176 <para>For <varname>m</varname> lines, this field should contain
177 the user name to add to a group.</para>
178
179 <para>For lines of type <varname>r</varname>, this field should
180 be set to <literal>-</literal>.</para>
181 </refsect2>
182
183 <refsect2>
184 <title>ID</title>
185
186 <para>For <varname>u</varname> and <varname>g</varname>, the
187 numeric 32-bit UID or GID of the user/group. Do not use IDs 65535
188 or 4294967295, as they have special placeholder meanings.
189 Specify <literal>-</literal> for automatic UID/GID allocation
190 for the user or group. Alternatively, specify an absolute path
191 in the file system. In this case, the UID/GID is read from the
192 path's owner/group. This is useful to create users whose UID/GID
193 match the owners of pre-existing files (such as SUID or SGID
194 binaries).</para>
195
196 <para>For <varname>m</varname> lines, this field should contain
197 the group name to add to a user to.</para>
198
199 <para>For lines of type <varname>r</varname>, this field should
200 be set to a UID/GID range in the format
201 <literal>FROM-TO</literal>, where both values are formatted as
202 decimal ASCII numbers. Alternatively, a single UID/GID may be
203 specified formatted as decimal ASCII numbers.</para>
204 </refsect2>
205
206 <refsect2>
207 <title>GECOS</title>
208
209 <para>A short, descriptive string for users to be created,
210 enclosed in quotation marks. Note that this field may not
211 contain colons.</para>
212
213 <para>Only applies to lines of type <varname>u</varname> and
214 should otherwise be left unset, or be set to
215 <literal>-</literal>.</para>
216 </refsect2>
217
218 <refsect2>
219 <title>Home Directory</title>
220
221 <para>The home directory for a new system user. If omitted,
222 defaults to the root directory. It is recommended to not
223 unnecessarily specify home directories for system users, unless
224 software strictly requires one to be set.</para>
225
226 <para>Only applies to lines of type <varname>u</varname> and
227 should otherwise be left unset, or be set to
228 <literal>-</literal>.</para>
229 </refsect2>
230 </refsect1>
231
232 <refsect1>
233 <title>Idempotence</title>
234
235 <para>Note that <command>systemd-sysusers</command> will do
236 nothing if the specified users or groups already exist, so
237 normally, there is no reason to override
238 <filename>sysusers.d</filename> vendor configuration, except to
239 block certain users or groups from being created.</para>
240 </refsect1>
241
242 <refsect1>
243 <title>See Also</title>
244 <para>
245 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
246 <citerefentry><refentrytitle>systemd-sysusers</refentrytitle><manvolnum>8</manvolnum></citerefentry>
247 </para>
248 </refsect1>
249
250 </refentry>