source: chapter06/shadow.xml@ 2a975935

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 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 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 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 2a975935 was 2a975935, checked in by Bruce Dubbs <bdubbs@…>, 7 years ago

Add a fix (embeeded patch) to shadow to fix an upstream bug.
Minor text change in adjusting toolchanin.

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@11189 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 22.3 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-ch6-sbu;</seg>
35 <seg>&shadow-ch6-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 by the
55 <xref linkend="man-pages"/> package:</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:</para>
69
70<screen><userinput remap="pre">sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@' \
71 -e 's@/var/spool/mail@/var/mail@' etc/login.defs</userinput></screen>
72
73 <para>Now fix a bug that prevents <command>useradd</command> from
74 setting the shell entry in the /etc/passwd file. In this case we need a
75 short patch, but can include it directly here without the need for a
76 separate file:</para>
77
78<screen><userinput remap="pre">echo '--- src/useradd.c (old)
79+++ src/useradd.c (new)
80@@ -2027,6 +2027,8 @@
81 is_shadow_grp = sgr_file_present ();
82 #endif
83
84+ get_defaults ();
85+
86 process_flags (argc, argv);
87
88 #ifdef ENABLE_SUBIDS
89@@ -2036,8 +2038,6 @@
90 (!user_id || (user_id &lt;= uid_max &amp;&amp; user_id >= uid_min));
91 #endif /* ENABLE_SUBIDS */
92
93- get_defaults ();
94-
95 #ifdef ACCT_TOOLS_SETUID
96 #ifdef USE_PAM
97 {' | patch -p0 -l</userinput></screen>
98
99 <note>
100 <para>If you chose to build Shadow with Cracklib support, run the following:</para>
101
102<screen role="nodump"><userinput>sed -i 's@DICTPATH.*@DICTPATH\t/lib/cracklib/pw_dict@' etc/login.defs</userinput></screen>
103 </note>
104
105 <para>Make a minor change to make the default useradd consistent with the LFS
106 groups file:</para>
107
108<screen><userinput remap="pre">sed -i 's/1000/999/' etc/useradd</userinput></screen>
109
110 <para>Fix a security issue identified upstream:</para>
111
112<screen><userinput remap="pre">sed -i -e '47 d' -e '60,65 d' libmisc/myname.c</userinput></screen>
113
114 <para>Prepare Shadow for compilation:</para>
115
116<screen><userinput remap="configure">./configure --sysconfdir=/etc --with-group-name-max-length=32</userinput></screen>
117
118 <variablelist>
119 <title>The meaning of the configure option:</title>
120
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 install</userinput></screen>
140
141 <para>Move a misplaced program to its proper location:</para>
142
143<screen><userinput remap="install">mv -v /usr/bin/passwd /bin</userinput></screen>
144
145 <!-- <para>Move Shadow's libraries to more appropriate locations:</para>
146
147<screen><userinput remap="install">mv -v /lib/libshadow.*a /usr/lib
148rm -v /lib/libshadow.so
149ln -sfv ../../lib/libshadow.so.0 /usr/lib/libshadow.so</userinput></screen> -->
150
151 </sect2>
152
153 <sect2 id="conf-shadow" role="configuration">
154 <title>Configuring Shadow</title>
155
156 <indexterm zone="conf-shadow">
157 <primary sortas="a-Shadow">Shadow</primary>
158 <secondary>configuring</secondary>
159 </indexterm>
160
161 <para>This package contains utilities to add, modify, and delete users and
162 groups; set and change their passwords; and perform other administrative
163 tasks. For a full explanation of what <emphasis>password shadowing</emphasis>
164 means, see the <filename>doc/HOWTO</filename> file within the unpacked
165 source tree. If using Shadow support, keep in mind that programs which need
166 to verify passwords (display managers, FTP programs, pop3 daemons, etc.)
167 must be Shadow-compliant. That is, they need to be able to work with
168 shadowed passwords.</para>
169
170 <para>To enable shadowed passwords, run the following command:</para>
171
172<screen><userinput>pwconv</userinput></screen>
173
174 <para>To enable shadowed group passwords, run:</para>
175
176<screen><userinput>grpconv</userinput></screen>
177
178 <para>Shadow's stock configuration for the <command>useradd</command>
179 utility has a few caveats that need some explanation. First, the default
180 action for the <command>useradd</command> utility is to create the user and
181 a group of the same name as the user. By default the user ID (UID) and
182 group ID (GID) numbers will begin with 1000. This means if you don't pass
183 parameters to <command>useradd</command>, each user will be a member of a
184 unique group on the system. If this behavior is undesirable, you'll need
185 to pass the <parameter>-g</parameter> parameter to
186 <command>useradd</command>. The default parameters are stored in the
187 <filename>/etc/default/useradd</filename> file. You may need to modify two
188 parameters in this file to suit your particular needs.</para>
189
190 <variablelist>
191 <title><filename>/etc/default/useradd</filename> Parameter Explanations</title>
192
193 <varlistentry>
194 <term><parameter>GROUP=1000</parameter></term>
195 <listitem>
196 <para>This parameter sets the beginning of the group numbers used in
197 the /etc/group file. You can modify it to anything you desire. Note
198 that <command>useradd</command> will never reuse a UID or GID. If the
199 number identified in this parameter is used, it will use the next
200 available number after this. Note also that if you don't have a group
201 1000 on your system the first time you use <command>useradd</command>
202 without the <parameter>-g</parameter> parameter, you'll get a message
203 displayed on the terminal that says:
204 <computeroutput>useradd: unknown GID 1000</computeroutput>. You may
205 disregard this message and group number 1000 will be used.</para>
206 </listitem>
207 </varlistentry>
208 <varlistentry>
209 <term><parameter>CREATE_MAIL_SPOOL=yes</parameter></term>
210 <listitem>
211 <para>This parameter causes <command>useradd</command> to create a
212 mailbox file for the newly created user. <command>useradd</command>
213 will make the group ownership of this file to the
214 <systemitem class="groupname">mail</systemitem> group with 0660
215 permissions. If you would prefer that these mailbox files are not
216 created by <command>useradd</command>, issue the following
217 command:</para>
218
219<screen><userinput>sed -i 's/yes/no/' /etc/default/useradd</userinput></screen>
220 </listitem>
221 </varlistentry>
222
223 </variablelist>
224
225
226 </sect2>
227
228 <sect2 role="configuration">
229 <title>Setting the root password</title>
230
231 <para>Choose a password for user <emphasis>root</emphasis> and set it
232 by running:</para>
233
234<screen role="nodump"><userinput>passwd root</userinput></screen>
235
236 </sect2>
237
238 <sect2 id="contents-shadow" role="content">
239 <title>Contents of Shadow</title>
240
241 <segmentedlist>
242 <segtitle>Installed programs</segtitle>
243 <segtitle>Installed directory</segtitle>
244
245 <seglistitem>
246 <seg>chage, chfn, chgpasswd, chpasswd, chsh, expiry, faillog, gpasswd,
247 groupadd, groupdel, groupmems, groupmod, grpck, grpconv, grpunconv,
248 lastlog, login, logoutd, newgidmap, newgrp, newuidmap, newusers,
249 nologin, passwd, pwck, pwconv, pwunconv, sg (link to newgrp), su,
250 useradd, userdel, usermod, vigr (link to vipw), and vipw</seg>
251 <seg>/etc/default</seg>
252 </seglistitem>
253 </segmentedlist>
254
255 <variablelist>
256 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
257 <?dbfo list-presentation="list"?>
258 <?dbhtml list-presentation="table"?>
259
260 <varlistentry id="chage">
261 <term><command>chage</command></term>
262 <listitem>
263 <para>Used to change the maximum number of days between obligatory
264 password changes</para>
265 <indexterm zone="ch-system-shadow chage">
266 <primary sortas="b-chage">chage</primary>
267 </indexterm>
268 </listitem>
269 </varlistentry>
270
271 <varlistentry id="chfn">
272 <term><command>chfn</command></term>
273 <listitem>
274 <para>Used to change a user's full name and other information</para>
275 <indexterm zone="ch-system-shadow chfn">
276 <primary sortas="b-chfn">chfn</primary>
277 </indexterm>
278 </listitem>
279 </varlistentry>
280
281 <varlistentry id="chgpasswd">
282 <term><command>chgpasswd</command></term>
283 <listitem>
284 <para>Used to update group passwords in batch mode</para>
285 <indexterm zone="ch-system-shadow chgpasswd">
286 <primary sortas="b-chgpasswd">chgpasswd</primary>
287 </indexterm>
288 </listitem>
289 </varlistentry>
290
291 <varlistentry id="chpasswd">
292 <term><command>chpasswd</command></term>
293 <listitem>
294 <para>Used to update user passwords in batch mode</para>
295 <indexterm zone="ch-system-shadow chpasswd">
296 <primary sortas="b-chpasswd">chpasswd</primary>
297 </indexterm>
298 </listitem>
299 </varlistentry>
300
301 <varlistentry id="chsh">
302 <term><command>chsh</command></term>
303 <listitem>
304 <para>Used to change a user's default login shell</para>
305 <indexterm zone="ch-system-shadow chsh">
306 <primary sortas="b-chsh">chsh</primary>
307 </indexterm>
308 </listitem>
309 </varlistentry>
310
311 <varlistentry id="expiry">
312 <term><command>expiry</command></term>
313 <listitem>
314 <para>Checks and enforces the current password expiration policy</para>
315 <indexterm zone="ch-system-shadow expiry">
316 <primary sortas="b-expiry">expiry</primary>
317 </indexterm>
318 </listitem>
319 </varlistentry>
320
321 <varlistentry id="faillog">
322 <term><command>faillog</command></term>
323 <listitem>
324 <para>Is used to examine the log of login failures, to set a maximum
325 number of failures before an account is blocked, or to reset the
326 failure count</para>
327 <indexterm zone="ch-system-shadow faillog">
328 <primary sortas="b-faillog">faillog</primary>
329 </indexterm>
330 </listitem>
331 </varlistentry>
332
333 <varlistentry id="gpasswd">
334 <term><command>gpasswd</command></term>
335 <listitem>
336 <para>Is used to add and delete members and administrators to
337 groups</para>
338 <indexterm zone="ch-system-shadow gpasswd">
339 <primary sortas="b-gpasswd">gpasswd</primary>
340 </indexterm>
341 </listitem>
342 </varlistentry>
343
344 <varlistentry id="groupadd">
345 <term><command>groupadd</command></term>
346 <listitem>
347 <para>Creates a group with the given name</para>
348 <indexterm zone="ch-system-shadow groupadd">
349 <primary sortas="b-groupadd">groupadd</primary>
350 </indexterm>
351 </listitem>
352 </varlistentry>
353
354 <varlistentry id="groupdel">
355 <term><command>groupdel</command></term>
356 <listitem>
357 <para>Deletes the group with the given name</para>
358 <indexterm zone="ch-system-shadow groupdel">
359 <primary sortas="b-groupdel">groupdel</primary>
360 </indexterm>
361 </listitem>
362 </varlistentry>
363
364 <varlistentry id="groupmems">
365 <term><command>groupmems</command></term>
366 <listitem>
367 <para>Allows a user to administer his/her own group membership list
368 without the requirement of super user privileges.</para>
369 <indexterm zone="ch-system-shadow groupmems">
370 <primary sortas="b-groupmems">groupmems</primary>
371 </indexterm>
372 </listitem>
373 </varlistentry>
374
375 <varlistentry id="groupmod">
376 <term><command>groupmod</command></term>
377 <listitem>
378 <para>Is used to modify the given group's name or GID</para>
379 <indexterm zone="ch-system-shadow groupmod">
380 <primary sortas="b-groupmod">groupmod</primary>
381 </indexterm>
382 </listitem>
383 </varlistentry>
384
385 <varlistentry id="grpck">
386 <term><command>grpck</command></term>
387 <listitem>
388 <para>Verifies the integrity of the group files
389 <filename>/etc/group</filename> and
390 <filename>/etc/gshadow</filename></para>
391 <indexterm zone="ch-system-shadow grpck">
392 <primary sortas="b-grpck">grpck</primary>
393 </indexterm>
394 </listitem>
395 </varlistentry>
396
397 <varlistentry id="grpconv">
398 <term><command>grpconv</command></term>
399 <listitem>
400 <para>Creates or updates the shadow group file from the normal
401 group file</para>
402 <indexterm zone="ch-system-shadow grpconv">
403 <primary sortas="b-grpconv">grpconv</primary>
404 </indexterm>
405 </listitem>
406 </varlistentry>
407
408 <varlistentry id="grpunconv">
409 <term><command>grpunconv</command></term>
410 <listitem>
411 <para>Updates <filename>/etc/group</filename> from
412 <filename>/etc/gshadow</filename> and then deletes the latter</para>
413 <indexterm zone="ch-system-shadow grpunconv">
414 <primary sortas="b-grpunconv">grpunconv</primary>
415 </indexterm>
416 </listitem>
417 </varlistentry>
418
419 <varlistentry id="lastlog">
420 <term><command>lastlog</command></term>
421 <listitem>
422 <para>Reports the most recent login of all users or of a
423 given user</para>
424 <indexterm zone="ch-system-shadow lastlog">
425 <primary sortas="b-lastlog">lastlog</primary>
426 </indexterm>
427 </listitem>
428 </varlistentry>
429
430 <varlistentry id="login">
431 <term><command>login</command></term>
432 <listitem>
433 <para>Is used by the system to let users sign on</para>
434 <indexterm zone="ch-system-shadow login">
435 <primary sortas="b-login">login</primary>
436 </indexterm>
437 </listitem>
438 </varlistentry>
439
440 <varlistentry id="logoutd">
441 <term><command>logoutd</command></term>
442 <listitem>
443 <para>Is a daemon used to enforce restrictions on log-on time
444 and ports</para>
445 <indexterm zone="ch-system-shadow logoutd">
446 <primary sortas="b-logoutd">logoutd</primary>
447 </indexterm>
448 </listitem>
449 </varlistentry>
450
451 <varlistentry id="newgidmap">
452 <term><command>newgidmap</command></term>
453 <listitem>
454 <para>Is used to set the gid mapping of a user namespace</para>
455 <indexterm zone="ch-system-shadow newgidmap">
456 <primary sortas="b-newgidmap">newgidmap</primary>
457 </indexterm>
458 </listitem>
459 </varlistentry>
460
461 <varlistentry id="newgrp">
462 <term><command>newgrp</command></term>
463 <listitem>
464 <para>Is used to change the current GID during a login session</para>
465 <indexterm zone="ch-system-shadow newgrp">
466 <primary sortas="b-newgrp">newgrp</primary>
467 </indexterm>
468 </listitem>
469 </varlistentry>
470
471 <varlistentry id="newuidmap">
472 <term><command>newuidmap</command></term>
473 <listitem>
474 <para>Is used to set the uid mapping of a user namespace</para>
475 <indexterm zone="ch-system-shadow newuidmap">
476 <primary sortas="b-newuidmap">newuidmap</primary>
477 </indexterm>
478 </listitem>
479 </varlistentry>
480
481 <varlistentry id="newusers">
482 <term><command>newusers</command></term>
483 <listitem>
484 <para>Is used to create or update an entire series of user
485 accounts</para>
486 <indexterm zone="ch-system-shadow newusers">
487 <primary sortas="b-newusers">newusers</primary>
488 </indexterm>
489 </listitem>
490 </varlistentry>
491
492 <varlistentry id="nologin">
493 <term><command>nologin</command></term>
494 <listitem>
495 <para>Displays a message that an account is not available; it is designed
496 to be used as the default shell for accounts that have been
497 disabled</para>
498 <indexterm zone="ch-system-shadow nologin">
499 <primary sortas="b-nologin">nologin</primary>
500 </indexterm>
501 </listitem>
502 </varlistentry>
503
504 <varlistentry id="passwd">
505 <term><command>passwd</command></term>
506 <listitem>
507 <para>Is used to change the password for a user or group account</para>
508 <indexterm zone="ch-system-shadow passwd">
509 <primary sortas="b-passwd">passwd</primary>
510 </indexterm>
511 </listitem>
512 </varlistentry>
513
514 <varlistentry id="pwck">
515 <term><command>pwck</command></term>
516 <listitem>
517 <para>Verifies the integrity of the password files
518 <filename>/etc/passwd</filename> and
519 <filename>/etc/shadow</filename></para>
520 <indexterm zone="ch-system-shadow pwck">
521 <primary sortas="b-pwck">pwck</primary>
522 </indexterm>
523 </listitem>
524 </varlistentry>
525
526 <varlistentry id="pwconv">
527 <term><command>pwconv</command></term>
528 <listitem>
529 <para>Creates or updates the shadow password file from the normal
530 password file</para>
531 <indexterm zone="ch-system-shadow pwconv">
532 <primary sortas="b-pwconv">pwconv</primary>
533 </indexterm>
534 </listitem>
535 </varlistentry>
536
537 <varlistentry id="pwunconv">
538 <term><command>pwunconv</command></term>
539 <listitem>
540 <para>Updates <filename>/etc/passwd</filename> from
541 <filename>/etc/shadow</filename> and then deletes the latter</para>
542 <indexterm zone="ch-system-shadow pwunconv">
543 <primary sortas="b-pwunconv">pwunconv</primary>
544 </indexterm>
545 </listitem>
546 </varlistentry>
547
548 <varlistentry id="sg">
549 <term><command>sg</command></term>
550 <listitem>
551 <para>Executes a given command while the user's GID
552 is set to that of the given group</para>
553 <indexterm zone="ch-system-shadow sg">
554 <primary sortas="b-sg">sg</primary>
555 </indexterm>
556 </listitem>
557 </varlistentry>
558
559 <varlistentry id="su">
560 <term><command>su</command></term>
561 <listitem>
562 <para>Runs a shell with substitute user and group IDs</para>
563 <indexterm zone="ch-system-shadow su">
564 <primary sortas="b-su">su</primary>
565 </indexterm>
566 </listitem>
567 </varlistentry>
568
569 <varlistentry id="useradd">
570 <term><command>useradd</command></term>
571 <listitem>
572 <para>Creates a new user with the given name, or updates the default
573 new-user information</para>
574 <indexterm zone="ch-system-shadow useradd">
575 <primary sortas="b-useradd">useradd</primary>
576 </indexterm>
577 </listitem>
578 </varlistentry>
579
580 <varlistentry id="userdel">
581 <term><command>userdel</command></term>
582 <listitem>
583 <para>Deletes the given user account</para>
584 <indexterm zone="ch-system-shadow userdel">
585 <primary sortas="b-userdel">userdel</primary>
586 </indexterm>
587 </listitem>
588 </varlistentry>
589
590 <varlistentry id="usermod">
591 <term><command>usermod</command></term>
592 <listitem>
593 <para>Is used to modify the given user's login name, User
594 Identification (UID), shell, initial group, home directory, etc.</para>
595 <indexterm zone="ch-system-shadow usermod">
596 <primary sortas="b-usermod">usermod</primary>
597 </indexterm>
598 </listitem>
599 </varlistentry>
600
601 <varlistentry id="vigr">
602 <term><command>vigr</command></term>
603 <listitem>
604 <para>Edits the <filename>/etc/group</filename> or
605 <filename>/etc/gshadow</filename> files</para>
606 <indexterm zone="ch-system-shadow vigr">
607 <primary sortas="b-vigr">vigr</primary>
608 </indexterm>
609 </listitem>
610 </varlistentry>
611
612 <varlistentry id="vipw">
613 <term><command>vipw</command></term>
614 <listitem>
615 <para>Edits the <filename>/etc/passwd</filename> or
616 <filename>/etc/shadow</filename> files</para>
617 <indexterm zone="ch-system-shadow vipw">
618 <primary sortas="b-vipw">vipw</primary>
619 </indexterm>
620 </listitem>
621 </varlistentry>
622
623 </variablelist>
624
625 </sect2>
626
627</sect1>
Note: See TracBrowser for help on using the repository browser.