]>
Commit | Line | Data |
---|---|---|
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 ZJS |
5 | SPDX-License-Identifier: LGPL-2.1+ |
6 | ||
21236ab5 LP |
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 | --> | |
e6de49ab | 24 | <refentry id="sysusers.d" conditional='ENABLE_SYSUSERS' |
798d3a52 ZJS |
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> | |
9b5c390f YW |
52 | <para><filename>/etc/sysusers.d/*.conf</filename></para> |
53 | <para><filename>/run/sysusers.d/*.conf</filename></para> | |
798d3a52 ZJS |
54 | <para><filename>/usr/lib/sysusers.d/*.conf</filename></para> |
55 | </refsynopsisdiv> | |
56 | ||
57 | <refsect1> | |
58 | <title>Description</title> | |
59 | ||
565dab8e LP |
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> | |
798d3a52 ZJS |
65 | </refsect1> |
66 | ||
67 | <refsect1> | |
8165be2e | 68 | <title>Configuration Directories and Precedence</title> |
798d3a52 ZJS |
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 | ||
8165be2e ZJS |
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 | ||
798d3a52 ZJS |
103 | <para>The file format is one line per user or group containing |
104 | name, ID, GECOS field description and home directory:</para> | |
105 | ||
07970eec ZJS |
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> | |
21236ab5 | 112 | |
565dab8e LP |
113 | <para>Empty lines and lines beginning with the <literal>#</literal> character are ignored, and may be used for |
114 | commenting.</para> | |
115 | ||
798d3a52 ZJS |
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 | |
cd72d204 | 146 | do not exist yet, they will be implicitly |
798d3a52 ZJS |
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 | |
b938cb90 | 154 | is specified, the range of UIDs/GIDs is set to some |
798d3a52 ZJS |
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 | ||
565dab8e LP |
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> | |
798d3a52 | 175 | |
b938cb90 | 176 | <para>For <varname>m</varname> lines, this field should contain |
798d3a52 ZJS |
177 | the user name to add to a group.</para> |
178 | ||
b938cb90 | 179 | <para>For lines of type <varname>r</varname>, this field should |
798d3a52 ZJS |
180 | be set to <literal>-</literal>.</para> |
181 | </refsect2> | |
182 | ||
183 | <refsect2> | |
184 | <title>ID</title> | |
185 | ||
b938cb90 JE |
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 | |
798d3a52 ZJS |
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 | |
b938cb90 | 191 | in the file system. In this case, the UID/GID is read from the |
798d3a52 ZJS |
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 | |
4cb41413 MV |
194 | binaries). |
195 | The syntax <literal><replaceable>uid</replaceable>:<replaceable>gid</replaceable></literal> is also supported to | |
28e7fad7 | 196 | 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. |
4cb41413 | 197 | </para> |
798d3a52 | 198 | |
b938cb90 | 199 | <para>For <varname>m</varname> lines, this field should contain |
798d3a52 ZJS |
200 | the group name to add to a user to.</para> |
201 | ||
b938cb90 | 202 | <para>For lines of type <varname>r</varname>, this field should |
798d3a52 | 203 | be set to a UID/GID range in the format |
b938cb90 | 204 | <literal>FROM-TO</literal>, where both values are formatted as |
798d3a52 ZJS |
205 | decimal ASCII numbers. Alternatively, a single UID/GID may be |
206 | specified formatted as decimal ASCII numbers.</para> | |
207 | </refsect2> | |
208 | ||
209 | <refsect2> | |
210 | <title>GECOS</title> | |
211 | ||
212 | <para>A short, descriptive string for users to be created, | |
213 | enclosed in quotation marks. Note that this field may not | |
214 | contain colons.</para> | |
215 | ||
216 | <para>Only applies to lines of type <varname>u</varname> and | |
217 | should otherwise be left unset, or be set to | |
218 | <literal>-</literal>.</para> | |
219 | </refsect2> | |
220 | ||
221 | <refsect2> | |
222 | <title>Home Directory</title> | |
223 | ||
b938cb90 | 224 | <para>The home directory for a new system user. If omitted, |
798d3a52 ZJS |
225 | defaults to the root directory. It is recommended to not |
226 | unnecessarily specify home directories for system users, unless | |
227 | software strictly requires one to be set.</para> | |
228 | ||
229 | <para>Only applies to lines of type <varname>u</varname> and | |
230 | should otherwise be left unset, or be set to | |
231 | <literal>-</literal>.</para> | |
232 | </refsect2> | |
798d3a52 ZJS |
233 | </refsect1> |
234 | ||
798d3a52 ZJS |
235 | <refsect1> |
236 | <title>Idempotence</title> | |
237 | ||
238 | <para>Note that <command>systemd-sysusers</command> will do | |
239 | nothing if the specified users or groups already exist, so | |
a8eaaee7 | 240 | normally, there is no reason to override |
798d3a52 ZJS |
241 | <filename>sysusers.d</filename> vendor configuration, except to |
242 | block certain users or groups from being created.</para> | |
243 | </refsect1> | |
244 | ||
245 | <refsect1> | |
246 | <title>See Also</title> | |
247 | <para> | |
248 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
249 | <citerefentry><refentrytitle>systemd-sysusers</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
250 | </para> | |
251 | </refsect1> | |
21236ab5 LP |
252 | |
253 | </refentry> |