source: chapter08/shadow.xml@ b5e4ab7

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 b5e4ab7 was b5e4ab7, checked in by Xi Ruoyao <xry111@…>, 10 months ago

shadow: add description for libsubid

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