source: chapter08/shadow.xml@ ad89f7b0

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 ad89f7b0 was ad89f7b0, checked in by Bruce Dubbs <bdubbs@…>, 2 years ago

Package updates.
Update to e2fsprogs-1.46.5.
Update to zstd-1.5.1.
Update to expat-2.4.2.
Update to shadow-4.10.
Update to sysvinit-3.01.
Update to linux-5.15.12.
Update to iana-etc-20211224.
Update to openssl-3.0.1.
Update to eudev-3.2.11.
Update lfs-latest-git.php currency for new eudev location.

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