source: chapter08/shadow.xml@ f01f8a5

11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 bdubbs/gcc13 multilib renodr/libudev-from-systemd trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/update-glibc
Last change on this file since f01f8a5 was 54948b7, checked in by David Bryant <davidbryant@…>, 17 months ago

Straighten out capitalization, correct a few grammatical errors,
improve English idiom, clarify a few things, remove superfluous
verbiage, etc.

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