source: chapter08/shadow.xml@ 7f13657d

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 7f13657d was 7f13657d, checked in by Pierre Labastie <pierre.labastie@…>, 2 years ago

shadow: move /etc/default/useradd creation to "Configuration"

This is needed so that /etc/default/useradd is not removed by package
managers when rebuilding shadow in BLFS. Change the explanations in
the text accordingly.

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