source: postlfs/security/shadow.xml@ da4d54c

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 6.2 6.2.0 6.2.0-rc1 6.2.0-rc2 6.3 6.3-rc1 6.3-rc2 6.3-rc3 7.10 7.4 7.5 7.6 7.6-blfs 7.6-systemd 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind gimp3 gnome kde5-13430 kde5-14269 kde5-14686 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts krejzi/svn lazarus lxqt nosym perl-modules plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition systemd-11177 systemd-13485 trunk upgradedb xry111/for-12.3 xry111/intltool xry111/llvm18 xry111/soup3 xry111/spidermonkey128 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since da4d54c was 4d3f1239, checked in by Bruce Dubbs <bdubbs@…>, 19 years ago

Fix typo in find/sed command

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@5441 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 16.1 KB
RevLine 
[b4b71892]1<?xml version="1.0" encoding="ISO-8859-1"?>
[ff769b8c]2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
3 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
[b4b71892]4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 %general-entities;
[17fb537e]6
[31f3a57]7 <!ENTITY shadow-download-http "http://ftp.pld.org.pl/software/shadow/shadow-&shadow-version;.tar.bz2">
8 <!ENTITY shadow-download-ftp "ftp://ftp.pld.org.pl/software/shadow/shadow-&shadow-version;.tar.bz2">
[d8684cbc]9 <!ENTITY shadow-md5sum "5c6a105d89afb0900922260e9c5650cc">
[980ef86b]10 <!ENTITY shadow-size "1.0 MB">
[d8684cbc]11 <!ENTITY shadow-buildsize "13.6 MB">
[349b53dd]12 <!ENTITY shadow-time "0.3 SBU">
[b4b71892]13]>
14
[17fb537e]15<sect1 id="shadow" xreflabel="Shadow-&shadow-version;">
[322f172]16 <?dbhtml filename="shadow.html"?>
17
18 <sect1info>
19 <othername>$LastChangedBy$</othername>
20 <date>$Date$</date>
[e19ad480]21 <keywordset>
22 <keyword role="package">shadow-&shadow-version;.tar</keyword>
[9084c2eb]23 <keyword role="ftpdir">shadow</keyword>
[e19ad480]24 </keywordset>
[322f172]25 </sect1info>
26
27 <title>Shadow-&shadow-version;</title>
28
29 <indexterm zone="shadow">
30 <primary sortas="a-Shadow">Shadow</primary>
31 </indexterm>
32
33 <sect2 role="package">
34 <title>Introduction to Shadow</title>
35
36 <para><application>Shadow</application> was indeed installed in LFS and
37 there is no reason to reinstall it unless you installed
[d8684cbc]38 <application>Linux-PAM</application>. If you did install
39 <application>Linux-PAM</application>, reinstalling
40 <application>Shadow</application> will allow programs such as
41 <command>login</command> and <command>su</command> to utilize PAM.</para>
[322f172]42
43 <bridgehead renderas="sect3">Package Information</bridgehead>
44 <itemizedlist spacing="compact">
45 <listitem>
46 <para>Download (HTTP): <ulink url="&shadow-download-http;"/></para>
47 </listitem>
48 <listitem>
49 <para>Download (FTP): <ulink url="&shadow-download-ftp;"/></para>
50 </listitem>
51 <listitem>
52 <para>Download MD5 sum: &shadow-md5sum;</para>
53 </listitem>
54 <listitem>
55 <para>Download size: &shadow-size;</para>
56 </listitem>
57 <listitem>
58 <para>Estimated disk space required: &shadow-buildsize;</para>
59 </listitem>
60 <listitem>
61 <para>Estimated build time: &shadow-time;</para>
62 </listitem>
63 </itemizedlist>
64
65 <bridgehead renderas="sect3">Additional Downloads</bridgehead>
66 <itemizedlist spacing='compact'>
67 <listitem>
[d8684cbc]68 <para>Required patch: <ulink
69 url="&patch-root;/shadow-&shadow-version;-configure_fix-1.patch"/></para>
[322f172]70 </listitem>
71 </itemizedlist>
72
73 <bridgehead renderas="sect3">Shadow Dependencies</bridgehead>
74
75 <bridgehead renderas="sect4">Required</bridgehead>
[e19ad480]76 <para role="required"><xref linkend="linux-pam"/></para>
[322f172]77
78 </sect2>
79
80 <sect2 role="installation">
81 <title>Installation of Shadow</title>
82
83 <para>Reinstall <application>Shadow</application> by running the following
84 commands:</para>
85
[90bc173]86<screen><userinput>patch -Np1 -i ../shadow-&shadow-version;-configure_fix-1.patch &amp;&amp;
87./configure --libdir=/lib --enable-shared \
[4fcf20a5]88 --with-libpam --without-libcrack &amp;&amp;
89sed -i 's/groups$(EXEEXT) //' src/Makefile &amp;&amp;
[4d3f1239]90find man -name Makefile -exec sed -i '/groups/d' {} \; &amp;&amp;
[322f172]91make</userinput></screen>
[17fb537e]92
[31f3a57]93 <para>This package does not come with a test suite.</para>
94
[322f172]95 <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
[17fb537e]96
[322f172]97<screen role="root"><userinput>make install &amp;&amp;
[4fcf20a5]98mv -v /usr/bin/passwd /bin &amp;&amp;
99mv -v /lib/libshadow.*a /usr/lib &amp;&amp;
100rm -v /lib/libshadow.so &amp;&amp;
[322f172]101ln -v -sf ../../lib/libshadow.so.0 /usr/lib/libshadow.so</userinput></screen>
[b4b71892]102
[322f172]103 </sect2>
[b4b71892]104
[322f172]105 <sect2 role="commands">
106 <title>Command Explanations</title>
[b4b71892]107
[322f172]108 <para><parameter>--without-libcrack</parameter>: This switch tells
109 <application>Shadow</application> not to use
110 <filename class='libraryfile'>libcrack</filename>. This is desired as
[d8684cbc]111 <application>Linux-PAM</application> will provide
112 <filename class='libraryfile'>libcrack</filename> functionality.</para>
[31f3a57]113
[322f172]114 <para><command>sed -i ...</command>: These commands are used to suppress
[d8684cbc]115 the installation of the <command>groups</command> program and man pages
116 as the version from the <application>Coreutils</application> package
117 installed during LFS is preferred.</para>
[39975e9]118
[322f172]119 </sect2>
[b4b71892]120
[322f172]121 <sect2 role="configuration">
122 <title>Configuring Linux-PAM to Work with Shadow</title>
[b4b71892]123
[322f172]124 <sect3 id="pam.d">
125 <title>Config Files</title>
[b4b71892]126
[1ba671c]127 <para><filename>/etc/pam.d/*</filename> or alternatively
128 <filename>/etc/pam.conf, /etc/login.defs and
129 /etc/security/*</filename></para>
[b4b71892]130
[322f172]131 <indexterm zone="shadow pam.d">
132 <primary sortas="e-etc-pam.d">/etc/pam.d/*</primary>
133 </indexterm>
[2197589]134
[322f172]135 <indexterm zone="shadow pam.d">
136 <primary sortas="e-etc-pam.conf">/etc/pam.conf</primary>
137 </indexterm>
[4fcf20a5]138
[1ba671c]139 <indexterm zone="shadow pam.d">
140 <primary sortas="e-etc-login.defs">/etc/login.defs</primary>
141 </indexterm>
142
143 <indexterm zone="shadow pam.d">
144 <primary sortas="e-etc-security">/etc/security/*</primary>
145 </indexterm>
146
[322f172]147 </sect3>
148
149 <sect3>
150 <title>Configuration Information</title>
151
[1ba671c]152 <sect4 id="pam-login-defs">
153 <title>Configuring /etc/login.defs</title>
154
155 <para>The <command>login</command> program currently performs many
156 functions which <application>Linux-PAM</application> modules should
157 now handle. The following <command>sed</command> command will comment
158 out the appropriate lines in <filename>/etc/login.defs</filename>, and
159 stop <command>login</command> from performing these functions (a backup
160 file named <filename>/etc/login.defs.orig</filename> is also created
[d8684cbc]161 to preserve the original file's contents). Issue the following commands
162 as the <systemitem class="username">root</systemitem> user:</para>
[1ba671c]163
164 <indexterm zone="shadow pam-login-defs">
165 <primary sortas="e-etc-login.defs">/etc/login.defs</primary>
166 </indexterm>
167
168<screen role="root"><userinput>install -v -m644 /etc/login.defs /etc/login.defs.orig &amp;&amp;
169for FUNCTION in LASTLOG_ENAB MAIL_CHECK_ENAB \
170 PORTTIME_CHECKS_ENAB CONSOLE \
171 MOTD_FILE NOLOGINS_FILE PASS_MIN_LEN \
172 SU_WHEEL_ONLY MD5_CRYPT_ENAB \
173 CONSOLE_GROUPS ENVIRON_FILE \
174 ULIMIT ENV_TZ ENV_HZ ENV_SUPATH \
175 ENV_PATH QMAIL_DIR MAIL_DIR MAIL_FILE \
176 CHFN_AUTH FAILLOG_ENAB QUOTAS_ENAB FTMP_FILE
177do
[d8684cbc]178 sed -i "s/^$FUNCTION/# &amp;/" /etc/login.defs
[1ba671c]179done</userinput></screen>
180
181 <para>If you have <application>CrackLib</application> installed,
[d8684cbc]182 also comment out four more lines using the following command as the
183 <systemitem class="username">root</systemitem> user:</para>
[1ba671c]184
185<screen role="root"><userinput>for FUNCTION in OBSCURE_CHECKS_ENAB CRACKLIB_DICTPATH \
186 PASS_CHANGE_TRIES PASS_ALWAYS_WARN
187do
[d8684cbc]188 sed -i "s/^$FUNCTION/# &amp;/" /etc/login.defs
[1ba671c]189done</userinput></screen>
190
191 </sect4>
192
193 <sect4>
194 <title>Configuring the /etc/pam.d/ Files</title>
195
196 <para>Add the following <application>Linux-PAM</application> configuration
197 files to <filename class="directory">/etc/pam.d/</filename> (or add them
198 to <filename>/etc/pam.conf</filename> with the additional field for
[d8684cbc]199 the program). Issue the commands as the
200 <systemitem class="username">root</systemitem> user:</para>
[1ba671c]201
202 </sect4>
[322f172]203
204 <sect4>
[974951c]205 <title>'login' (with CrackLib)</title>
[322f172]206
207<screen role="root"><userinput>cat &gt; /etc/pam.d/login &lt;&lt; "EOF"
208<literal># Begin /etc/pam.d/login
[4fcf20a5]209
210auth requisite pam_securetty.so
211auth requisite pam_nologin.so
212auth required pam_unix.so
213account required pam_access.so
214account required pam_unix.so
[7fb0e285]215session required pam_env.so
[4fcf20a5]216session required pam_motd.so
217session required pam_limits.so
218session optional pam_mail.so dir=/var/mail standard
219session optional pam_lastlog.so
220session required pam_unix.so
221password required pam_cracklib.so retry=3 difok=8 minlen=5 \
222 dcredit=3 ocredit=3 \
223 ucredit=2 lcredit=2
224password required pam_unix.so md5 shadow use_authtok
225
[322f172]226# End /etc/pam.d/login</literal>
227EOF</userinput></screen>
228
229 </sect4>
[4fcf20a5]230
[322f172]231 <sect4>
[974951c]232 <title>'login' (without CrackLib)</title>
[4fcf20a5]233
[322f172]234<screen role="root"><userinput>cat &gt; /etc/pam.d/login &lt;&lt; "EOF"
235<literal># Begin /etc/pam.d/login
[b4b71892]236
237auth requisite pam_securetty.so
238auth requisite pam_nologin.so
239auth required pam_env.so
240auth required pam_unix.so
241account required pam_access.so
242account required pam_unix.so
243session required pam_motd.so
244session required pam_limits.so
[4fcf20a5]245session optional pam_mail.so dir=/var/mail standard
[b4b71892]246session optional pam_lastlog.so
247session required pam_unix.so
[4fcf20a5]248password required pam_unix.so md5 shadow
[b4b71892]249
[322f172]250# End /etc/pam.d/login</literal>
251EOF</userinput></screen>
[4fcf20a5]252
[322f172]253 </sect4>
[4fcf20a5]254
[322f172]255 <sect4>
[974951c]256 <title>'passwd' (with CrackLib)</title>
[322f172]257
258<screen role="root"><userinput>cat &gt; /etc/pam.d/passwd &lt;&lt; "EOF"
259<literal># Begin /etc/pam.d/passwd
[b4b71892]260
[4fcf20a5]261password required pam_cracklib.so retry=3 difok=8 minlen=5 \
262 dcredit=3 ocredit=3 \
263 ucredit=2 lcredit=2
264password required pam_unix.so md5 shadow use_authtok
[b4b71892]265
[322f172]266# End /etc/pam.d/passwd</literal>
267EOF</userinput></screen>
268
269 </sect4>
[b4b71892]270
[322f172]271 <sect4>
[974951c]272 <title>'passwd' (without CrackLib)</title>
[4fcf20a5]273
[322f172]274<screen role="root"><userinput>cat &gt; /etc/pam.d/passwd &lt;&lt; "EOF"
275<literal># Begin /etc/pam.d/passwd
[4fcf20a5]276
277password required pam_unix.so md5 shadow
[b4b71892]278
[322f172]279# End /etc/pam.d/passwd</literal>
280EOF</userinput></screen>
281
282 </sect4>
[4fcf20a5]283
[322f172]284 <sect4>
285 <title>'su'</title>
[4fcf20a5]286
[322f172]287<screen role="root"><userinput>cat &gt; /etc/pam.d/su &lt;&lt; "EOF"
288<literal># Begin /etc/pam.d/su
[b4b71892]289
290auth sufficient pam_rootok.so
291auth required pam_unix.so
292account required pam_unix.so
[4fcf20a5]293session optional pam_mail.so dir=/var/mail standard
[7fb0e285]294session required pam_env.so
[b4b71892]295session required pam_unix.so
296
[322f172]297# End /etc/pam.d/su</literal>
298EOF</userinput></screen>
[b4b71892]299
[322f172]300 </sect4>
[b4b71892]301
[322f172]302 <sect4>
303 <title>'chage'</title>
304
305<screen role="root"><userinput>cat &gt; /etc/pam.d/chage &lt;&lt; "EOF"
306<literal># Begin /etc/pam.d/chage
[b4b71892]307
308auth sufficient pam_rootok.so
309auth required pam_unix.so
310account required pam_unix.so
311session required pam_unix.so
312password required pam_permit.so
313
[322f172]314# End /etc/pam.d/chage</literal>
315EOF</userinput></screen>
316
317 </sect4>
[b4b71892]318
[322f172]319 <sect4>
320 <title>'chpasswd', 'newusers', 'groupadd', 'groupdel',
321 'groupmod', 'useradd', 'userdel', and 'usermod'</title>
[39975e9]322
[322f172]323<screen role="root"><userinput>for PROGRAM in chpasswd newusers groupadd groupdel \
[4fcf20a5]324 groupmod useradd userdel usermod
325do
[904f31e2]326 install -v -m644 /etc/pam.d/chage /etc/pam.d/$PROGRAM
[d8684cbc]327 sed -i "s/chage/$PROGRAM/" /etc/pam.d/$PROGRAM
[322f172]328done</userinput></screen>
329
330 <warning>
331 <para>At this point, you should do a simple test to see if
332 <application>Shadow</application> is working as expected. Open
[1ba671c]333 another terminal and log in as a user, then <command>su</command> to
[974951c]334 <systemitem class="username">root</systemitem>. If you do not see any
335 errors, then all is well and you should proceed with the rest of the
[322f172]336 configuration. If you did receive errors, stop now and double check
[974951c]337 the above configuration files manually. If you cannot find and
[322f172]338 fix the error, you should recompile <application>Shadow</application>
339 replacing <option>--with-libpam</option> with
[1ba671c]340 <option>--without-libpam</option> in the above instructions (also move
341 the <filename>/etc/login.defs.orig</filename> backup file to
342 <filename>/etc/login.defs</filename>). If you
[322f172]343 fail to do this and the errors remain, you will be unable to log into
344 your system.</para>
345 </warning>
346
[349b53dd]347 </sect4>
348
349 <sect4>
350 <title>Other</title>
351
[322f172]352 <para>Currently, <filename>/etc/pam.d/other</filename> is configured
353 to allow anyone with an account on the machine to use PAM-aware
354 programs without a configuration file for that program. After testing
355 <application>Linux-PAM</application> for proper configuration, install
356 a more restrictive <filename>other</filename> file so that
357 program-specific configuration files are required:</para>
358
359<screen role="root"><userinput>cat &gt; /etc/pam.d/other &lt;&lt; "EOF"
360<literal># Begin /etc/pam.d/other
[b4b71892]361
362auth required pam_deny.so
363auth required pam_warn.so
364account required pam_deny.so
365session required pam_deny.so
366password required pam_deny.so
367password required pam_warn.so
368
[322f172]369# End /etc/pam.d/other</literal>
370EOF</userinput></screen>
[4fcf20a5]371
[322f172]372 </sect4>
[4fcf20a5]373
[322f172]374 <sect4 id="pam-access">
375 <title>Configuring Login Access</title>
[4fcf20a5]376
[322f172]377 <para>Instead of using the <filename>/etc/login.access</filename>
378 file for controlling access to the system,
379 <application>Linux-PAM</application> uses the
380 <filename class='libraryfile'>pam_access.so</filename> module along
381 with the <filename>/etc/security/access.conf</filename> file. Rename
382 the <filename>/etc/login.access</filename> file using the following
383 command:</para>
384
385 <indexterm zone="shadow pam-access">
386 <primary sortas="e-etc-security-access.conf">/etc/security/access.conf</primary>
387 </indexterm>
388
389<screen role="root"><userinput>if [ -f /etc/login.access ]; then
[4fcf20a5]390 mv -v /etc/login.access /etc/login.access.NOUSE
[322f172]391fi</userinput></screen>
392
393 </sect4>
394
395 <sect4 id="pam-limits">
396 <title>Configuring Resource Limits</title>
397
398 <para>Instead of using the <filename>/etc/limits</filename> file
399 for limiting usage of system resources,
400 <application>Linux-PAM</application> uses the
401 <filename class='libraryfile'>pam_limits.so</filename> module along
402 with the <filename>/etc/security/limits.conf</filename> file. Rename
403 the <filename>/etc/limits</filename> file using the following
404 command:</para>
405
406 <indexterm zone="shadow pam-limits">
407 <primary sortas="e-etc-security-limits.conf">/etc/security/limits.conf</primary>
408 </indexterm>
409
410<screen role="root"><userinput>if [ -f /etc/limits ]; then
[4fcf20a5]411 mv -v /etc/limits /etc/limits.NOUSE
[322f172]412fi</userinput></screen>
413
414 </sect4>
[4fcf20a5]415
[7fb0e285]416 <sect4 id="pam-env">
417 <title>Configuring Default Environment</title>
418
[bccbdaea]419 <para>During previous configuration, several items were removed from
[7fb0e285]420 <filename>/etc/login.defs</filename>. Some of these items are now
[bccbdaea]421 controlled by the <filename class='libraryfile'>pam_env.so</filename>
422 module and the <filename>/etc/security/pam_env.conf</filename>
423 configuration file. In particular, the default path has been
424 changed. To recover your default path, execute the following
[7fb0e285]425 commands:</para>
426
[d8684cbc]427<screen role="root"><userinput>ENV_PATH=`grep '^ENV_PATH' /etc/login.defs.orig | \
[7fb0e285]428 awk '{ print $2 }' | sed 's/PATH=//'` &amp;&amp;
[d8684cbc]429echo 'PATH DEFAULT='`echo "${ENV_PATH}"`\
430' OVERRIDE=${PATH}' \
[7fb0e285]431 >> /etc/security/pam_env.conf &amp;&amp;
[d8684cbc]432unset ENV_PATH</userinput></screen>
[7fb0e285]433
[d8684cbc]434 <note>
[bccbdaea]435 <para>ENV_SUPATH is no longer supported. You must create
436 a valid <filename>/root/.bashrc</filename> file to provide a
[d8684cbc]437 modified path for the super-user.</para>
438 </note>
[7fb0e285]439
440 </sect4>
441
[322f172]442 </sect3>
[b4b71892]443
[322f172]444 </sect2>
[f45b1953]445
[322f172]446 <sect2 role="content">
447 <title>Contents</title>
[17fb537e]448
[322f172]449 <para>A list of the installed files, along with their short descriptions
450 can be found at
451 <ulink url="&lfs-root;/chapter06/shadow.html#contents-shadow"/>.</para>
[17fb537e]452
[322f172]453 </sect2>
[17fb537e]454
[f45b1953]455</sect1>
Note: See TracBrowser for help on using the repository browser.