source: chapter08/shadow.xml@ 52155b6

11.1 11.2 11.2-rc1 arm multilib s6-init trunk xry111/arm64 xry111/clfs-ng xry111/lfs-next xry111/pip3 xry111/queue-11.3 xry111/rust-wip-20221008
Last change on this file since 52155b6 was 52155b6, checked in by Xi Ruoyao <xry111@…>, 10 months ago

shadow: add --disable-static

Approved by bdubbs for 11.1.

To editors: no need to rebuild system and re-tag anything, AFAIK nothing
in BLFS uses libsubid now. You may delete /usr/lib/libsubid.a on your
system manually.

  • 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 get rid of <filename class="directory">/bin</filename> and
70 <filename class="directory">/sbin</filename> from <envar>PATH</envar>,
71 since they are simply symlinks to their counterpart in
72 <filename class="directory">/usr</filename>.</para>
73
74 <note>
75 <para>If <filename class="directory">/bin</filename> and/or
76 <filename class="directory">/sbin</filename> are preferred to be
77 left over in <envar>PATH</envar> for some reason, modify
78 <envar>PATH</envar> in <filename>.bashrc</filename> after LFS is
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, run the following:</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 configure option:</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, and
118 if it does not exist, the default location is not right.</para>
119 </listitem>
120 </varlistentry>
121 <varlistentry>
122 <term><parameter>--with-group-name-max-length=32</parameter></term>
123 <listitem>
124 <para>The maximum user name is 32 characters. Make the maximum
125 group name the same.</para>
126 </listitem>
127 </varlistentry>
128
129 </variablelist>
130
131 <para>Compile the package:</para>
132
133 <screen><userinput remap="make">make</userinput></screen>
134
135 <para>This package does not come with a test suite.</para>
136
137 <para>Install the package:</para>
138
139 <screen><userinput remap="install">make exec_prefix=/usr install
140make -C man install-man</userinput></screen>
141
142 </sect2>
143
144 <sect2 id="conf-shadow" role="configuration">
145 <title>Configuring Shadow</title>
146
147 <indexterm zone="conf-shadow">
148 <primary sortas="a-Shadow">Shadow</primary>
149 <secondary>configuring</secondary>
150 </indexterm>
151
152 <para>This package contains utilities to add, modify, and delete users and
153 groups; set and change their passwords; and perform other administrative
154 tasks. For a full explanation of what <emphasis>password shadowing</emphasis>
155 means, see the <filename>doc/HOWTO</filename> file within the unpacked
156 source tree. If using Shadow support, keep in mind that programs which need
157 to verify passwords (display managers, FTP programs, pop3 daemons, etc.)
158 must be Shadow-compliant. That is, they need to be able to work with
159 shadowed passwords.</para>
160
161 <para>To enable shadowed passwords, run the following command:</para>
162
163<screen><userinput>pwconv</userinput></screen>
164
165 <para>To enable shadowed group passwords, run:</para>
166
167<screen><userinput>grpconv</userinput></screen>
168
169 <para>Shadow's default configuration for the <command>useradd</command>
170 utility has a few caveats that need some explanation. First, the default
171 action for the <command>useradd</command> utility is to create the user and
172 a group of the same name as the user. By default the user ID (UID) and
173 group ID (GID) numbers will begin with 1000. This means if you don't pass
174 parameters to <command>useradd</command>, each user will be a member of a
175 unique group on the system. If this behavior is undesirable, you'll need
176 to pass one of the <parameter>-g</parameter> or <parameter>-N</parameter>
177 parameter to <command>useradd</command> or to change the setting of
178 <parameter>USERGROUPS_ENAB</parameter> in
179 <filename>/etc/login.defs</filename>. See <filename>useradd(8)</filename>
180 for more information.</para>
181
182 <para>Second, to change the default parameters, the file
183 <filename>/etc/default/useradd</filename> needs to be created and taylored
184 to suit your particular needs. Create it with:</para>
185
186<screen><userinput>mkdir -p /etc/default
187useradd -D --gid 999</userinput></screen>
188
189 <variablelist>
190 <title><filename>/etc/default/useradd</filename> Parameter Explanations</title>
191
192 <varlistentry>
193 <term><parameter>GROUP=999</parameter></term>
194 <listitem>
195 <para>This parameter sets the beginning of the group numbers used in
196 the <filename>/etc/group</filename> file. The particular value 999
197 comes from the <parameter>--gid</parameter> parameter above. You can
198 modify it to anything you desire.
199
200 Note that <command>useradd</command> will never reuse a UID or GID.
201 If the number identified in this parameter is used, it will use the
202 next available number. Note also that if you don't have a group with
203 an ID equal to this number on your system the first time you use
204 <command>useradd</command> without the <parameter>-g</parameter>
205 parameter, you will get a message displayed on the terminal that
206 says: <computeroutput>useradd: unknown GID 999</computeroutput>,
207 although the account is correctly created. That is why we have
208 created the group <systemitem class="groupname">users</systemitem>
209 with this group ID in <xref linkend='ch-tools-createfiles'/>.</para>
210
211 </listitem>
212 </varlistentry>
213 <varlistentry>
214 <term><parameter>CREATE_MAIL_SPOOL=yes</parameter></term>
215 <listitem>
216 <para>This parameter causes <command>useradd</command> to create a
217 mailbox file for the newly created user. <command>useradd</command>
218 will make the group ownership of this file to the
219 <systemitem class="groupname">mail</systemitem> group with 0660
220 permissions. If you would prefer that these mailbox files are not
221 created by <command>useradd</command>, issue the following
222 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 directory</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</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, or 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 that an account is not available; it is designed
513 to be used as the default shell for accounts that have been
514 disabled</para>
515 <indexterm zone="ch-system-shadow nologin">
516 <primary sortas="b-nologin">nologin</primary>
517 </indexterm>
518 </listitem>
519 </varlistentry>
520
521 <varlistentry id="passwd">
522 <term><command>passwd</command></term>
523 <listitem>
524 <para>Is used to change the password for a user or group account</para>
525 <indexterm zone="ch-system-shadow passwd">
526 <primary sortas="b-passwd">passwd</primary>
527 </indexterm>
528 </listitem>
529 </varlistentry>
530
531 <varlistentry id="pwck">
532 <term><command>pwck</command></term>
533 <listitem>
534 <para>Verifies the integrity of the password files
535 <filename>/etc/passwd</filename> and
536 <filename>/etc/shadow</filename></para>
537 <indexterm zone="ch-system-shadow pwck">
538 <primary sortas="b-pwck">pwck</primary>
539 </indexterm>
540 </listitem>
541 </varlistentry>
542
543 <varlistentry id="pwconv">
544 <term><command>pwconv</command></term>
545 <listitem>
546 <para>Creates or updates the shadow password file from the normal
547 password file</para>
548 <indexterm zone="ch-system-shadow pwconv">
549 <primary sortas="b-pwconv">pwconv</primary>
550 </indexterm>
551 </listitem>
552 </varlistentry>
553
554 <varlistentry id="pwunconv">
555 <term><command>pwunconv</command></term>
556 <listitem>
557 <para>Updates <filename>/etc/passwd</filename> from
558 <filename>/etc/shadow</filename> and then deletes the latter</para>
559 <indexterm zone="ch-system-shadow pwunconv">
560 <primary sortas="b-pwunconv">pwunconv</primary>
561 </indexterm>
562 </listitem>
563 </varlistentry>
564
565 <varlistentry id="sg">
566 <term><command>sg</command></term>
567 <listitem>
568 <para>Executes a given command while the user's GID
569 is set to that of the given group</para>
570 <indexterm zone="ch-system-shadow sg">
571 <primary sortas="b-sg">sg</primary>
572 </indexterm>
573 </listitem>
574 </varlistentry>
575
576 <varlistentry id="su">
577 <term><command>su</command></term>
578 <listitem>
579 <para>Runs a shell with substitute user and group IDs</para>
580 <indexterm zone="ch-system-shadow su">
581 <primary sortas="b-su">su</primary>
582 </indexterm>
583 </listitem>
584 </varlistentry>
585
586 <varlistentry id="useradd">
587 <term><command>useradd</command></term>
588 <listitem>
589 <para>Creates a new user with the given name, or updates the default
590 new-user information</para>
591 <indexterm zone="ch-system-shadow useradd">
592 <primary sortas="b-useradd">useradd</primary>
593 </indexterm>
594 </listitem>
595 </varlistentry>
596
597 <varlistentry id="userdel">
598 <term><command>userdel</command></term>
599 <listitem>
600 <para>Deletes the given user account</para>
601 <indexterm zone="ch-system-shadow userdel">
602 <primary sortas="b-userdel">userdel</primary>
603 </indexterm>
604 </listitem>
605 </varlistentry>
606
607 <varlistentry id="usermod">
608 <term><command>usermod</command></term>
609 <listitem>
610 <para>Is used to modify the given user's login name, User
611 Identification (UID), shell, initial group, home directory, etc.</para>
612 <indexterm zone="ch-system-shadow usermod">
613 <primary sortas="b-usermod">usermod</primary>
614 </indexterm>
615 </listitem>
616 </varlistentry>
617
618 <varlistentry id="vigr">
619 <term><command>vigr</command></term>
620 <listitem>
621 <para>Edits the <filename>/etc/group</filename> or
622 <filename>/etc/gshadow</filename> files</para>
623 <indexterm zone="ch-system-shadow vigr">
624 <primary sortas="b-vigr">vigr</primary>
625 </indexterm>
626 </listitem>
627 </varlistentry>
628
629 <varlistentry id="vipw">
630 <term><command>vipw</command></term>
631 <listitem>
632 <para>Edits the <filename>/etc/passwd</filename> or
633 <filename>/etc/shadow</filename> files</para>
634 <indexterm zone="ch-system-shadow vipw">
635 <primary sortas="b-vipw">vipw</primary>
636 </indexterm>
637 </listitem>
638 </varlistentry>
639
640 <varlistentry id="libsubid">
641 <term><filename class='libraryfile'>libsubid</filename></term>
642 <listitem>
643 <para>library for process subordinate id ranges for users</para>
644 <indexterm zone="ch-system-shadow libsubid">
645 <primary sortas="c-libsubid">libsubid</primary>
646 </indexterm>
647 </listitem>
648 </varlistentry>
649
650 </variablelist>
651
652 </sect2>
653
654</sect1>
Note: See TracBrowser for help on using the repository browser.