source: chapter06/shadow.xml@ b7b0eea

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 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 9.1 arm bdubbs/gcc13 ml-11.0 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 b7b0eea was b7b0eea, checked in by Douglas R. Reno <renodr@…>, 4 years ago

Update to bc-2.4.0
Update to linux-5.4.2
Update to systemd-244
Update to shadow-4.8

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@11706 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

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