5757 <refsect1 >
5858 <title >Description</title >
5959
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 >
60+ <para ><command >systemd-sysusers</command > uses the files from
61+ <filename >sysusers.d</filename > directory to create system users and groups and
62+ to add users to groups, at package installation or boot time. This tool may be
63+ used to allocate system users and groups only, it is not useful for creating
64+ non-system (i.e. regular, "human") users and groups, as it accesses
65+ <filename >/etc/passwd</filename > and <filename >/etc/group</filename > directly,
66+ bypassing any more complex user databases, for example any database involving NIS
67+ or LDAP.</para >
6568 </refsect1 >
6669
6770 <refsect1 >
100103 <refsect1 >
101104 <title >Configuration File Format</title >
102105
103- <para >The file format is one line per user or group containing
104- name, ID, GECOS field description and home directory :</para >
106+ <para >The file format is one line per user or group containing name, ID, GECOS
107+ field description, home directory, and login shell :</para >
105108
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 >
109+ <programlisting >#Type Name ID GECOS Home directory Shell
110+ u httpd 404 "HTTP User"
111+ u authd /usr/bin/authd "Authorization user"
112+ u postgres - "Postgresql Database" /var/lib/pgsql /usr/libexec/postgresdb
113+ g input - -
114+ m authd input
115+ u root 0 "Superuser" /root /bin/zsh</programlisting >
112116
113117 <para >Empty lines and lines beginning with the <literal >#</literal > character are ignored, and may be used for
114118 commenting.</para >
@@ -122,14 +126,10 @@ u root 0 "Superuser" /root</programlisting>
122126 <variablelist >
123127 <varlistentry >
124128 <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 >
129+ <listitem ><para >Create a system user and group of the specified name should
130+ they not exist yet. The user's primary group will be set to the group
131+ bearing the same name. The account will be created disabled, so that logins
132+ are not allowed.</para ></listitem >
133133 </varlistentry >
134134
135135 <varlistentry >
@@ -187,7 +187,8 @@ u root 0 "Superuser" /root</programlisting>
187187 numeric 32-bit UID or GID of the user/group. Do not use IDs 65535
188188 or 4294967295, as they have special placeholder meanings.
189189 Specify <literal >-</literal > for automatic UID/GID allocation
190- for the user or group. Alternatively, specify an absolute path
190+ for the user or group (this is strongly recommended unless it is strictly
191+ necessary to use a specific UID or GID). Alternatively, specify an absolute path
191192 in the file system. In this case, the UID/GID is read from the
192193 path's owner/group. This is useful to create users whose UID/GID
193194 match the owners of pre-existing files (such as SUID or SGID
@@ -209,37 +210,45 @@ u root 0 "Superuser" /root</programlisting>
209210 <refsect2 >
210211 <title >GECOS</title >
211212
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 >
213+ <para >A short, descriptive string for users to be created, enclosed in
214+ quotation marks. Note that this field may not contain colons.</para >
215215
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 >
216+ <para >Only applies to lines of type <varname >u</varname > and should otherwise
217+ be left unset (or <literal >-</literal >).</para >
219218 </refsect2 >
220219
221220 <refsect2 >
222221 <title >Home Directory</title >
223222
224- <para >The home directory for a new system user. If omitted,
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 >
223+ <para >The home directory for a new system user. If omitted, defaults to the
224+ root directory.</para >
228225
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 >
226+ <para >Only applies to lines of type <varname >u</varname > and should otherwise
227+ be left unset (or <literal >-</literal >). It is recommended to omit this, unless
228+ software strictly requires a home directory to be set.</para >
229+ </refsect2 >
230+
231+ <refsect2 >
232+ <title >Shell</title >
233+
234+ <para >The login shell of the user. If not specified, this will be set to
235+ <filename >/sbin/nologin</filename >, except if the UID of the user is 0, in
236+ which case <filename >/bin/sh</filename > will be used.</para >
237+
238+ <para >Only applies to lines of type <varname >u</varname > and should otherwise
239+ be left unset (or <literal >-</literal >). It is recommended to omit this, unless
240+ a shell different <filename >/sbin/nologin</filename > must be used.</para >
232241 </refsect2 >
233242 </refsect1 >
234243
235244 <refsect1 >
236245 <title >Idempotence</title >
237246
238- <para >Note that <command >systemd-sysusers</command > will do
239- nothing if the specified users or groups already exist, so
240- normally, there is no reason to override
241- <filename >sysusers.d</filename > vendor configuration, except to
242- block certain users or groups from being created.</para >
247+ <para >Note that <command >systemd-sysusers</command > will do nothing if the
248+ specified users or groups already exist or the users are members of specified
249+ groups, so normally there is no reason to override
250+ <filename >sysusers.d</filename > vendor configuration, except to block certain
251+ users or groups from being created.</para >
243252 </refsect1 >
244253
245254 <refsect1 >
0 commit comments