source: chapter08/shadow.xml@ 2b3f5219

11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 arm bdubbs/gcc13 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since 2b3f5219 was 2b3f5219, checked in by Pierre Labastie <pierre.labastie@…>, 2 years ago

Reword explanation of GROUP parameter in /etc/default/useradd

Tell that 999 comes from the --gid parameter, and that we already have
a group "users" with this gid to prevent messages when first using useradd.

  • Property mode set to 100644
File size: 23.2 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../general.ent">
5 %general-entities;
6]>
7
8<sect1 id="ch-system-shadow" role="wrap">
9 <?dbhtml filename="shadow.html"?>
10
11 <sect1info condition="script">
12 <productname>shadow</productname>
13 <productnumber>&shadow-version;</productnumber>
14 <address>&shadow-url;</address>
15 </sect1info>
16
17 <title>Shadow-&shadow-version;</title>
18
19 <indexterm zone="ch-system-shadow">
20 <primary sortas="a-Shadow">Shadow</primary>
21 </indexterm>
22
23 <sect2 role="package">
24 <title/>
25
26 <para>The Shadow package contains programs for handling passwords in a secure
27 way.</para>
28
29 <segmentedlist>
30 <segtitle>&buildtime;</segtitle>
31 <segtitle>&diskspace;</segtitle>
32
33 <seglistitem>
34 <seg>&shadow-fin-sbu;</seg>
35 <seg>&shadow-fin-du;</seg>
36 </seglistitem>
37 </segmentedlist>
38
39 </sect2>
40
41 <sect2 role="installation">
42 <title>Installation of Shadow</title>
43
44 <para>First, apply a fix to prevent a segmentation fault when running
45 <command>useradd</command>:</para>
46
47<!-- Hardcoding the patch version because it has been merged upstream and
48 the patch will be unnecessary when the next version is released. -->
49
50<screen><userinput remap="pre">patch -Np1 -i ../shadow-4.10-useradd_segfault-1.patch</userinput></screen>
51
52 <note>
53 <para>If you would like to enforce the use of strong passwords, refer to
54 <ulink url="&blfs-book;postlfs/cracklib.html"/> for installing
55 CrackLib prior to building Shadow. Then add
56 <parameter>--with-libcrack</parameter> to the <command>configure</command>
57 command below.</para>
58 </note>
59
60 <para>Disable the installation of the <command>groups</command> program
61 and its man pages, as Coreutils provides a better version. Also,
62 prevent the installation of manual pages that were already installed in
63 <xref linkend="ch-system-man-pages"/>:</para>
64
65<screen><userinput remap="pre">sed -i 's/groups$(EXEEXT) //' src/Makefile.in
66find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \;
67find man -name Makefile.in -exec sed -i 's/getspnam\.3 / /' {} \;
68find man -name Makefile.in -exec sed -i 's/passwd\.5 / /' {} \;</userinput></screen>
69
70 <para id="shadow-login_defs">Instead of using the default
71 <emphasis>crypt</emphasis> method, use the more secure
72 <emphasis>SHA-512</emphasis> method of password encryption, which also
73 allows passwords longer than 8 characters. It is also necessary to change
74 the obsolete <filename class="directory">/var/spool/mail</filename> location
75 for user mailboxes that Shadow uses by default to the <filename
76 class="directory">/var/mail</filename> location used currently. And,
77 get rid of <filename class="directory">/bin</filename> and
78 <filename class="directory">/sbin</filename> from <envar>PATH</envar>,
79 since they are simply symlinks to their counterpart in
80 <filename class="directory">/usr</filename>.</para>
81
82 <note>
83 <para>If <filename class="directory">/bin</filename> and/or
84 <filename class="directory">/sbin</filename> are preferred to be
85 left over in <envar>PATH</envar> for some reason, modify
86 <envar>PATH</envar> in <filename>.bashrc</filename> after LFS is
87 built.</para>
88 </note>
89
90<screen><userinput remap="pre">sed -e 's:#ENCRYPT_METHOD DES:ENCRYPT_METHOD SHA512:' \
91 -e 's:/var/spool/mail:/var/mail:' \
92 -e '/PATH=/{s@/sbin:@@;s@/bin:@@}' \
93 -i etc/login.defs</userinput></screen>
94
95 <note>
96 <para>If you chose to build Shadow with Cracklib support, run the following:</para>
97
98<screen role="nodump"><userinput>sed -i 's:DICTPATH.*:DICTPATH\t/lib/cracklib/pw_dict:' etc/login.defs</userinput></screen>
99 </note>
100<!--
101 <para>Make a minor change to make the first group number generated
102 by useradd 1000:</para>
103
104<screen><userinput remap="pre">sed -i 's/1000/999/' etc/useradd</userinput></screen>
105-->
106 <para>Fix a simple programming error by modifying a file with following command:</para>
107
108<screen><userinput remap="pre">sed -e "224s/rounds/min_rounds/" -i libmisc/salt.c</userinput></screen>
109
110 <para>Prepare Shadow for compilation:</para>
111
112<screen><userinput remap="configure">touch /usr/bin/passwd
113./configure --sysconfdir=/etc \
114 --with-group-name-max-length=32</userinput></screen>
115
116 <variablelist>
117 <title>The meaning of the configure option:</title>
118
119 <varlistentry>
120 <term><command>touch /usr/bin/passwd</command></term>
121 <listitem>
122 <para>The file <filename>/usr/bin/passwd</filename> needs
123 to exist because its location is harcoded in some programs, and
124 the default location if it does not exist is not right.</para>
125 </listitem>
126 </varlistentry>
127 <varlistentry>
128 <term><parameter>--with-group-name-max-length=32</parameter></term>
129 <listitem>
130 <para>The maximum user name is 32 characters. Make the maximum
131 group name the same.</para>
132 </listitem>
133 </varlistentry>
134
135 </variablelist>
136
137 <para>Compile the package:</para>
138
139 <screen><userinput remap="make">make</userinput></screen>
140
141 <para>This package does not come with a test suite.</para>
142
143 <para>Install the package:</para>
144
145 <screen><userinput remap="install">make exec_prefix=/usr install
146make -C man install-man</userinput></screen>
147
148 </sect2>
149
150 <sect2 id="conf-shadow" role="configuration">
151 <title>Configuring Shadow</title>
152
153 <indexterm zone="conf-shadow">
154 <primary sortas="a-Shadow">Shadow</primary>
155 <secondary>configuring</secondary>
156 </indexterm>
157
158 <para>This package contains utilities to add, modify, and delete users and
159 groups; set and change their passwords; and perform other administrative
160 tasks. For a full explanation of what <emphasis>password shadowing</emphasis>
161 means, see the <filename>doc/HOWTO</filename> file within the unpacked
162 source tree. If using Shadow support, keep in mind that programs which need
163 to verify passwords (display managers, FTP programs, pop3 daemons, etc.)
164 must be Shadow-compliant. That is, they need to be able to work with
165 shadowed passwords.</para>
166
167 <para>To enable shadowed passwords, run the following command:</para>
168
169<screen><userinput>pwconv</userinput></screen>
170
171 <para>To enable shadowed group passwords, run:</para>
172
173<screen><userinput>grpconv</userinput></screen>
174
175 <para>Shadow's default configuration for the <command>useradd</command>
176 utility has a few caveats that need some explanation. First, the default
177 action for the <command>useradd</command> utility is to create the user and
178 a group of the same name as the user. By default the user ID (UID) and
179 group ID (GID) numbers will begin with 1000. This means if you don't pass
180 parameters to <command>useradd</command>, each user will be a member of a
181 unique group on the system. If this behavior is undesirable, you'll need
182 to pass one of the <parameter>-g</parameter> or <parameter>-N</parameter>
183 parameter to <command>useradd</command> or to change the setting of
184 <parameter>USERGROUPS_ENAB</parameter> in
185 <filename>/etc/login.defs</filename>. See <filename>useradd(8)</filename>
186 for more information.</para>
187
188 <para>Second, to change the default parameters, the file
189 <filename>/etc/default/useradd</filename> needs to be created and taylored
190 to suit your particular needs. Create it with:</para>
191
192<screen><userinput>mkdir -p /etc/default
193useradd -D --gid 999</userinput></screen>
194
195 <variablelist>
196 <title><filename>/etc/default/useradd</filename> Parameter Explanations</title>
197
198 <varlistentry>
199 <term><parameter>GROUP=999</parameter></term>
200 <listitem>
201 <para>This parameter sets the beginning of the group numbers used in
202 the <filename>/etc/group</filename> file. The particular value 999
203 comes from the <parameter>--gid</parameter> parameter above.
204 You can modify it to anything you desire. Note that
205 <command>useradd</command> will never reuse a UID or GID. If the
206 number identified in this parameter is used, it will use the next
207 available number after this. Note also that if you don't have a
208 group with an ID equal to this number on your system the first
209 time you use <command>useradd</command>
210 without the <parameter>-g</parameter> parameter, you'll get a message
211 displayed on the terminal that says:
212 <computeroutput>useradd: unknown GID 999</computeroutput>, although
213 the account is correctly created. That is
214 why we have earlier created the group <parameter>users</parameter>
215 with this group ID.</para>
216 </listitem>
217 </varlistentry>
218 <varlistentry>
219 <term><parameter>CREATE_MAIL_SPOOL=yes</parameter></term>
220 <listitem>
221 <para>This parameter causes <command>useradd</command> to create a
222 mailbox file for the newly created user. <command>useradd</command>
223 will make the group ownership of this file to the
224 <systemitem class="groupname">mail</systemitem> group with 0660
225 permissions. If you would prefer that these mailbox files are not
226 created by <command>useradd</command>, issue the following
227 command:</para>
228
229<screen><userinput>sed -i '/MAIL/s/yes/no/' /etc/default/useradd</userinput></screen>
230 </listitem>
231 </varlistentry>
232
233 </variablelist>
234
235 </sect2>
236
237 <sect2 role="configuration">
238 <title>Setting the root password</title>
239
240 <para>Choose a password for user <emphasis>root</emphasis> and set it
241 by running:</para>
242
243<screen role="nodump"><userinput>passwd root</userinput></screen>
244
245 </sect2>
246
247 <sect2 id="contents-shadow" role="content">
248 <title>Contents of Shadow</title>
249
250 <segmentedlist>
251 <segtitle>Installed programs</segtitle>
252 <segtitle>Installed directory</segtitle>
253
254 <seglistitem>
255 <seg>chage, chfn, chgpasswd, chpasswd, chsh, expiry, faillog, gpasswd,
256 groupadd, groupdel, groupmems, groupmod, grpck, grpconv, grpunconv,
257 lastlog, login, logoutd, newgidmap, newgrp, newuidmap, newusers,
258 nologin, passwd, pwck, pwconv, pwunconv, sg (link to newgrp), su,
259 useradd, userdel, usermod, vigr (link to vipw), and vipw</seg>
260 <seg>/etc/default</seg>
261 </seglistitem>
262 </segmentedlist>
263
264 <variablelist>
265 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
266 <?dbfo list-presentation="list"?>
267 <?dbhtml list-presentation="table"?>
268
269 <varlistentry id="chage">
270 <term><command>chage</command></term>
271 <listitem>
272 <para>Used to change the maximum number of days between obligatory
273 password changes</para>
274 <indexterm zone="ch-system-shadow chage">
275 <primary sortas="b-chage">chage</primary>
276 </indexterm>
277 </listitem>
278 </varlistentry>
279
280 <varlistentry id="chfn">
281 <term><command>chfn</command></term>
282 <listitem>
283 <para>Used to change a user's full name and other information</para>
284 <indexterm zone="ch-system-shadow chfn">
285 <primary sortas="b-chfn">chfn</primary>
286 </indexterm>
287 </listitem>
288 </varlistentry>
289
290 <varlistentry id="chgpasswd">
291 <term><command>chgpasswd</command></term>
292 <listitem>
293 <para>Used to update group passwords in batch mode</para>
294 <indexterm zone="ch-system-shadow chgpasswd">
295 <primary sortas="b-chgpasswd">chgpasswd</primary>
296 </indexterm>
297 </listitem>
298 </varlistentry>
299
300 <varlistentry id="chpasswd">
301 <term><command>chpasswd</command></term>
302 <listitem>
303 <para>Used to update user passwords in batch mode</para>
304 <indexterm zone="ch-system-shadow chpasswd">
305 <primary sortas="b-chpasswd">chpasswd</primary>
306 </indexterm>
307 </listitem>
308 </varlistentry>
309
310 <varlistentry id="chsh">
311 <term><command>chsh</command></term>
312 <listitem>
313 <para>Used to change a user's default login shell</para>
314 <indexterm zone="ch-system-shadow chsh">
315 <primary sortas="b-chsh">chsh</primary>
316 </indexterm>
317 </listitem>
318 </varlistentry>
319
320 <varlistentry id="expiry">
321 <term><command>expiry</command></term>
322 <listitem>
323 <para>Checks and enforces the current password expiration policy</para>
324 <indexterm zone="ch-system-shadow expiry">
325 <primary sortas="b-expiry">expiry</primary>
326 </indexterm>
327 </listitem>
328 </varlistentry>
329
330 <varlistentry id="faillog">
331 <term><command>faillog</command></term>
332 <listitem>
333 <para>Is used to examine the log of login failures, to set a maximum
334 number of failures before an account is blocked, or to reset the
335 failure count</para>
336 <indexterm zone="ch-system-shadow faillog">
337 <primary sortas="b-faillog">faillog</primary>
338 </indexterm>
339 </listitem>
340 </varlistentry>
341
342 <varlistentry id="gpasswd">
343 <term><command>gpasswd</command></term>
344 <listitem>
345 <para>Is used to add and delete members and administrators to
346 groups</para>
347 <indexterm zone="ch-system-shadow gpasswd">
348 <primary sortas="b-gpasswd">gpasswd</primary>
349 </indexterm>
350 </listitem>
351 </varlistentry>
352
353 <varlistentry id="groupadd">
354 <term><command>groupadd</command></term>
355 <listitem>
356 <para>Creates a group with the given name</para>
357 <indexterm zone="ch-system-shadow groupadd">
358 <primary sortas="b-groupadd">groupadd</primary>
359 </indexterm>
360 </listitem>
361 </varlistentry>
362
363 <varlistentry id="groupdel">
364 <term><command>groupdel</command></term>
365 <listitem>
366 <para>Deletes the group with the given name</para>
367 <indexterm zone="ch-system-shadow groupdel">
368 <primary sortas="b-groupdel">groupdel</primary>
369 </indexterm>
370 </listitem>
371 </varlistentry>
372
373 <varlistentry id="groupmems">
374 <term><command>groupmems</command></term>
375 <listitem>
376 <para>Allows a user to administer his/her own group membership list
377 without the requirement of super user privileges.</para>
378 <indexterm zone="ch-system-shadow groupmems">
379 <primary sortas="b-groupmems">groupmems</primary>
380 </indexterm>
381 </listitem>
382 </varlistentry>
383
384 <varlistentry id="groupmod">
385 <term><command>groupmod</command></term>
386 <listitem>
387 <para>Is used to modify the given group's name or GID</para>
388 <indexterm zone="ch-system-shadow groupmod">
389 <primary sortas="b-groupmod">groupmod</primary>
390 </indexterm>
391 </listitem>
392 </varlistentry>
393
394 <varlistentry id="grpck">
395 <term><command>grpck</command></term>
396 <listitem>
397 <para>Verifies the integrity of the group files
398 <filename>/etc/group</filename> and
399 <filename>/etc/gshadow</filename></para>
400 <indexterm zone="ch-system-shadow grpck">
401 <primary sortas="b-grpck">grpck</primary>
402 </indexterm>
403 </listitem>
404 </varlistentry>
405
406 <varlistentry id="grpconv">
407 <term><command>grpconv</command></term>
408 <listitem>
409 <para>Creates or updates the shadow group file from the normal
410 group file</para>
411 <indexterm zone="ch-system-shadow grpconv">
412 <primary sortas="b-grpconv">grpconv</primary>
413 </indexterm>
414 </listitem>
415 </varlistentry>
416
417 <varlistentry id="grpunconv">
418 <term><command>grpunconv</command></term>
419 <listitem>
420 <para>Updates <filename>/etc/group</filename> from
421 <filename>/etc/gshadow</filename> and then deletes the latter</para>
422 <indexterm zone="ch-system-shadow grpunconv">
423 <primary sortas="b-grpunconv">grpunconv</primary>
424 </indexterm>
425 </listitem>
426 </varlistentry>
427
428 <varlistentry id="lastlog">
429 <term><command>lastlog</command></term>
430 <listitem>
431 <para>Reports the most recent login of all users or of a
432 given user</para>
433 <indexterm zone="ch-system-shadow lastlog">
434 <primary sortas="b-lastlog">lastlog</primary>
435 </indexterm>
436 </listitem>
437 </varlistentry>
438
439 <varlistentry id="login">
440 <term><command>login</command></term>
441 <listitem>
442 <para>Is used by the system to let users sign on</para>
443 <indexterm zone="ch-system-shadow login">
444 <primary sortas="b-login">login</primary>
445 </indexterm>
446 </listitem>
447 </varlistentry>
448
449 <varlistentry id="logoutd">
450 <term><command>logoutd</command></term>
451 <listitem>
452 <para>Is a daemon used to enforce restrictions on log-on time
453 and ports</para>
454 <indexterm zone="ch-system-shadow logoutd">
455 <primary sortas="b-logoutd">logoutd</primary>
456 </indexterm>
457 </listitem>
458 </varlistentry>
459
460 <varlistentry id="newgidmap">
461 <term><command>newgidmap</command></term>
462 <listitem>
463 <para>Is used to set the gid mapping of a user namespace</para>
464 <indexterm zone="ch-system-shadow newgidmap">
465 <primary sortas="b-newgidmap">newgidmap</primary>
466 </indexterm>
467 </listitem>
468 </varlistentry>
469
470 <varlistentry id="newgrp">
471 <term><command>newgrp</command></term>
472 <listitem>
473 <para>Is used to change the current GID during a login session</para>
474 <indexterm zone="ch-system-shadow newgrp">
475 <primary sortas="b-newgrp">newgrp</primary>
476 </indexterm>
477 </listitem>
478 </varlistentry>
479
480 <varlistentry id="newuidmap">
481 <term><command>newuidmap</command></term>
482 <listitem>
483 <para>Is used to set the uid mapping of a user namespace</para>
484 <indexterm zone="ch-system-shadow newuidmap">
485 <primary sortas="b-newuidmap">newuidmap</primary>
486 </indexterm>
487 </listitem>
488 </varlistentry>
489
490 <varlistentry id="newusers">
491 <term><command>newusers</command></term>
492 <listitem>
493 <para>Is used to create or update an entire series of user
494 accounts</para>
495 <indexterm zone="ch-system-shadow newusers">
496 <primary sortas="b-newusers">newusers</primary>
497 </indexterm>
498 </listitem>
499 </varlistentry>
500
501 <varlistentry id="nologin">
502 <term><command>nologin</command></term>
503 <listitem>
504 <para>Displays a message that an account is not available; it is designed
505 to be used as the default shell for accounts that have been
506 disabled</para>
507 <indexterm zone="ch-system-shadow nologin">
508 <primary sortas="b-nologin">nologin</primary>
509 </indexterm>
510 </listitem>
511 </varlistentry>
512
513 <varlistentry id="passwd">
514 <term><command>passwd</command></term>
515 <listitem>
516 <para>Is used to change the password for a user or group account</para>
517 <indexterm zone="ch-system-shadow passwd">
518 <primary sortas="b-passwd">passwd</primary>
519 </indexterm>
520 </listitem>
521 </varlistentry>
522
523 <varlistentry id="pwck">
524 <term><command>pwck</command></term>
525 <listitem>
526 <para>Verifies the integrity of the password files
527 <filename>/etc/passwd</filename> and
528 <filename>/etc/shadow</filename></para>
529 <indexterm zone="ch-system-shadow pwck">
530 <primary sortas="b-pwck">pwck</primary>
531 </indexterm>
532 </listitem>
533 </varlistentry>
534
535 <varlistentry id="pwconv">
536 <term><command>pwconv</command></term>
537 <listitem>
538 <para>Creates or updates the shadow password file from the normal
539 password file</para>
540 <indexterm zone="ch-system-shadow pwconv">
541 <primary sortas="b-pwconv">pwconv</primary>
542 </indexterm>
543 </listitem>
544 </varlistentry>
545
546 <varlistentry id="pwunconv">
547 <term><command>pwunconv</command></term>
548 <listitem>
549 <para>Updates <filename>/etc/passwd</filename> from
550 <filename>/etc/shadow</filename> and then deletes the latter</para>
551 <indexterm zone="ch-system-shadow pwunconv">
552 <primary sortas="b-pwunconv">pwunconv</primary>
553 </indexterm>
554 </listitem>
555 </varlistentry>
556
557 <varlistentry id="sg">
558 <term><command>sg</command></term>
559 <listitem>
560 <para>Executes a given command while the user's GID
561 is set to that of the given group</para>
562 <indexterm zone="ch-system-shadow sg">
563 <primary sortas="b-sg">sg</primary>
564 </indexterm>
565 </listitem>
566 </varlistentry>
567
568 <varlistentry id="su">
569 <term><command>su</command></term>
570 <listitem>
571 <para>Runs a shell with substitute user and group IDs</para>
572 <indexterm zone="ch-system-shadow su">
573 <primary sortas="b-su">su</primary>
574 </indexterm>
575 </listitem>
576 </varlistentry>
577
578 <varlistentry id="useradd">
579 <term><command>useradd</command></term>
580 <listitem>
581 <para>Creates a new user with the given name, or updates the default
582 new-user information</para>
583 <indexterm zone="ch-system-shadow useradd">
584 <primary sortas="b-useradd">useradd</primary>
585 </indexterm>
586 </listitem>
587 </varlistentry>
588
589 <varlistentry id="userdel">
590 <term><command>userdel</command></term>
591 <listitem>
592 <para>Deletes the given user account</para>
593 <indexterm zone="ch-system-shadow userdel">
594 <primary sortas="b-userdel">userdel</primary>
595 </indexterm>
596 </listitem>
597 </varlistentry>
598
599 <varlistentry id="usermod">
600 <term><command>usermod</command></term>
601 <listitem>
602 <para>Is used to modify the given user's login name, User
603 Identification (UID), shell, initial group, home directory, etc.</para>
604 <indexterm zone="ch-system-shadow usermod">
605 <primary sortas="b-usermod">usermod</primary>
606 </indexterm>
607 </listitem>
608 </varlistentry>
609
610 <varlistentry id="vigr">
611 <term><command>vigr</command></term>
612 <listitem>
613 <para>Edits the <filename>/etc/group</filename> or
614 <filename>/etc/gshadow</filename> files</para>
615 <indexterm zone="ch-system-shadow vigr">
616 <primary sortas="b-vigr">vigr</primary>
617 </indexterm>
618 </listitem>
619 </varlistentry>
620
621 <varlistentry id="vipw">
622 <term><command>vipw</command></term>
623 <listitem>
624 <para>Edits the <filename>/etc/passwd</filename> or
625 <filename>/etc/shadow</filename> files</para>
626 <indexterm zone="ch-system-shadow vipw">
627 <primary sortas="b-vipw">vipw</primary>
628 </indexterm>
629 </listitem>
630 </varlistentry>
631
632 </variablelist>
633
634 </sect2>
635
636</sect1>
Note: See TracBrowser for help on using the repository browser.