source: chapter08/shadow.xml@ da7949d

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

Minor reworing of reason for GID 999

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