source: chapter08/shadow.xml@ 4bcd65c

xry111/usr-move
Last change on this file since 4bcd65c was 4bcd65c, checked in by Xi Ruoyao <xry111@…>, 21 months ago

usr-move: configure shadow not to include /bin or /sbin in PATH

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