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