source: postlfs/security/shadow.xml@ 40d6bab

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 12.2 6.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 40d6bab was 974951c, checked in by Randy McMurchy <randy@…>, 19 years ago

Fixed typos in the Shadow instructions

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

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