source: chapter08/shadow.xml@ cd0ca937

11.1 11.1-rc1 arm multilib trunk xry111/clfs-ng xry111/lfs-next
Last change on this file since cd0ca937 was cd0ca937, checked in by Xi Ruoyao <xry111@…>, 6 months ago

shadow: fix a typo

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