source: postlfs/security/shadow.xml@ 0ef1837

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 6.0 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 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/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since 0ef1837 was 8f9c9862, checked in by DJ Lucas <dj@…>, 19 years ago

Updated to Linux-PAM-0.78 and added testing note to shadow instructions

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

  • Property mode set to 100644
File size: 8.7 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
3 "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 %general-entities;
6]>
7
8<sect1 id="shadow">
9<sect1info>
10<othername>$LastChangedBy$</othername>
11<date>$Date$</date>
12</sect1info>
13<?dbhtml filename="shadow.html"?>
14<title>Shadow-&shadow-version;</title>
15
16<!--
17<sect2>
18<title>Configuring shadow</title>
19
20<para>Shadow's Configuration File</para>
21
22<para><userinput>/etc/login.defs</userinput></para>
23
24<para>Enabling <acronym>MD</acronym>5 Passwords</para>
25
26<para>To enable <acronym>MD</acronym>5 Passwords, modify the line in the
27<filename>login.defs</filename> file that reads:
28<screen><userinput>#MD5_CRYPT_ENAB no</userinput></screen>
29to read:
30<screen><userinput>MD5_CRYPT_ENAB yes</userinput></screen>
31Passwords created after this change will be encrypted using
32<acronym>MD</acronym>5 (Message-Digest Algorithm) instead of using
33<acronym>DES</acronym> encryption.
34</para>
35</sect2>
36-->
37
38<sect2>
39<title>Introduction to <application>Shadow</application></title>
40
41<para>Shadow was indeed installed in <acronym>LFS</acronym> and there is
42no reason to reinstall it unless you installed
43<application>Linux-<acronym>PAM</acronym></application>. If you did,
44this will allow programs like <command>login</command> and
45<command>su</command> to utilize
46<acronym>PAM</acronym>.</para>
47
48<sect3><title>Additional downloads</title>
49<itemizedlist spacing='compact'>
50<listitem><para>Patch to fix linking against PAM:
51<ulink url="&patch-root;/shadow-&shadow-version;-pam-1.patch"/></para></listitem>
52</itemizedlist>
53</sect3>
54
55<sect3><title><application>Shadow</application> dependencies</title>
56<sect4><title>Required</title>
57<para><xref linkend="Linux_PAM"/></para></sect4>
58</sect3>
59</sect2>
60
61<sect2>
62<title>Installation of <application>Shadow</application></title>
63
64<para>Reinstall <application>Shadow</application> by running the following
65commands:</para>
66
67<screen><userinput><command>patch -Np1 -i ../shadow-&shadow-version;-pam-1.patch &amp;&amp;
68LIBS="-lpam -lpam_misc" ./configure --libdir=/usr/lib \
69 --enable-shared --with-libpam --without-libcrack &amp;&amp;
70echo '#define HAVE_SETLOCALE 1' >> config.h &amp;&amp;
71sed -i '/extern char/d' libmisc/xmalloc.c &amp;&amp;
72make &amp;&amp;
73make install &amp;&amp;
74mv /bin/sg /usr/bin &amp;&amp;
75mv /bin/vigr /usr/sbin &amp;&amp;
76mv /usr/bin/passwd /bin &amp;&amp;
77rm /bin/groups &amp;&amp;
78mv /usr/lib/lib{misc,shadow}.so.0* /lib &amp;&amp;
79ln -sf ../../lib/libshadow.so.0 /usr/lib/libshadow.so &amp;&amp;
80ln -sf ../../lib/libmisc.so.0 /usr/lib/libmisc.so</command></userinput></screen>
81
82</sect2>
83
84<sect2>
85<title>Command explanations</title>
86
87<para><parameter>--without-libcrack</parameter>: This switch tells
88<application>Shadow</application> not to use
89<filename class='libraryfile'>libcrack</filename>. This is desired as
90<application>Linux-<acronym>PAM</acronym></application> already contains
91<filename class='libraryfile'>libcrack</filename>.</para>
92
93<para><command>sed -i '/extern char/d' libmisc/xmalloc.c</command>: This
94fixes a compilation problem when using <application>GCC</application>-3.4.x.
95</para>
96
97<!-- Leftover from older instructions????
98<para><command>cp debian/securetty /etc/securetty</command>: This
99command sets the tty's that allow logins through <acronym>PAM</acronym>.</para>
100-->
101
102</sect2>
103
104<sect2>
105<title>Configuring <application>Linux-<acronym>PAM</acronym></application> to work
106with <application>Shadow</application></title>
107
108<sect3><title>Config files</title>
109<para><filename>/etc/pam.d/login</filename>,
110<filename>/etc/pam.d/passwd</filename>,
111<filename>/etc/pam.d/su</filename>,
112<filename>/etc/pam.d/shadow</filename>,
113<filename>/etc/pam.d/useradd</filename>, and
114<filename>/etc/pam.d/chage</filename> &ndash;
115alternatively, <filename>/etc/pam.conf</filename></para>
116</sect3>
117
118<sect3><title>Configuration Information</title>
119
120<para>Add the following <application>Linux-<acronym>PAM</acronym></application>
121configuration files to <filename class="directory">/etc/pam.d/</filename> (or
122add them to <filename>/etc/pam.conf</filename> with the additional field for
123the program).</para>
124
125<screen><userinput><command>cat &gt; /etc/pam.d/login &lt;&lt; "EOF"</command>
126# Begin /etc/pam.d/login
127
128auth requisite pam_securetty.so
129auth requisite pam_nologin.so
130auth required pam_env.so
131auth required pam_unix.so
132account required pam_access.so
133account required pam_unix.so
134session required pam_motd.so
135session required pam_limits.so
136session optional pam_mail.so dir=/var/mail standard
137session optional pam_lastlog.so
138session required pam_unix.so
139
140# End /etc/pam.d/login
141<command>EOF
142cat &gt; /etc/pam.d/passwd &lt;&lt; "EOF"</command>
143# Begin /etc/pam.d/passwd
144
145password required pam_unix.so md5 shadow
146
147# End /etc/pam.d/passwd
148<command>EOF
149cat &gt; /etc/pam.d/shadow &lt;&lt; "EOF"</command>
150# Begin /etc/pam.d/shadow
151
152auth sufficient pam_rootok.so
153auth required pam_unix.so
154account required pam_unix.so
155session required pam_unix.so
156password required pam_permit.so
157
158# End /etc/pam.d/shadow
159<command>EOF
160cat &gt; /etc/pam.d/su &lt;&lt; "EOF"</command>
161# Begin /etc/pam.d/su
162
163auth sufficient pam_rootok.so
164auth required pam_unix.so
165account required pam_unix.so
166session required pam_unix.so
167
168# End /etc/pam.d/su
169<command>EOF
170cat &gt; /etc/pam.d/useradd &lt;&lt; "EOF"</command>
171# Begin /etc/pam.d/useradd
172
173auth sufficient pam_rootok.so
174auth required pam_unix.so
175account required pam_unix.so
176session required pam_unix.so
177password required pam_permit.so
178
179# End /etc/pam.d/useradd
180<command>EOF
181cat &gt; /etc/pam.d/chage &lt;&lt; "EOF"</command>
182# Begin /etc/pam.d/chage
183
184auth sufficient pam_rootok.so
185auth required pam_unix.so
186account required pam_unix.so
187session required pam_unix.so
188password required pam_permit.so
189
190# End /etc/pam.d/chage
191<command>EOF</command></userinput></screen>
192
193<note><para>If you've installed <application>cracklib</application>, replace
194<filename>/etc/pam.d/passwd</filename> with the following:</para></note>
195<screen><userinput><command>cat &gt; /etc/pam.d/passwd &lt;&lt; "EOF"</command>
196# Begin /etc/pam.d/passwd
197
198password required pam_cracklib.so \
199 retry=3 difok=8 minlen=5 dcredit=3 ocredit=3 ucredit=2 lcredit=2
200password required pam_unix.so md5 shadow use_authtok
201
202# End /etc/pam.d/passwd
203<command>EOF</command></userinput></screen>
204
205<note><para>At this point, you should do a simple test to see if
206<application>Shadow</application> is
207working as expected. Open another term and login as a user, then su to
208to root. If you do not see any errors, then all is well and you should
209proceed with the rest of the configuration. If you did
210receive errors, stop now and double check the above configuration files
211manually. If you cannot find, and fix the error, you should recopile
212shadow replacing <envar>--with-libpam</envar> with
213<envar>--without-libpam</envar> in the above
214instructions. If you fail to do this and the errors remain, you
215will be unable to log into your system.</para></note>
216
217<para>Currently, <filename>/etc/pam.d/other</filename> is configured to
218allow anyone with an account on the machine to use programs
219that do not specifically have a configuration file of their own. After
220testing <application>Linux-<acronym>PAM</acronym></application> for proper
221configuration, it can be changed to the following:</para>
222
223<screen><userinput><command>cat &gt; /etc/pam.d/other &lt;&lt; "EOF"</command>
224# Begin /etc/pam.d/other
225
226auth required pam_deny.so
227auth required pam_warn.so
228account required pam_deny.so
229session required pam_deny.so
230password required pam_deny.so
231password required pam_warn.so
232
233# End /etc/pam.d/other
234<command>EOF</command></userinput></screen>
235
236<para>Finally, edit <filename>/etc/login.defs</filename> by adding '#'
237to the beginning of the following lines:</para>
238<screen>LASTLOG_ENAB
239MAIL_CHECK_ENAB
240PORTTIME_CHECKS_ENAB
241CONSOLE
242MOTD_FILE
243NOLOGINS_FILE
244PASS_MIN_LEN
245SU_WHEEL_ONLY
246MD5_CRYPT_ENAB
247CONSOLE_GROUPS
248ENVIRON_FILE</screen>
249
250<para>This stops <command>login</command> from performing these functions, as
251they will now be performed by <acronym>PAM</acronym> modules. Additionally,
252add a '#' to the beginning of the following lines if you've installed
253<application>cracklib</application>:</para>
254<screen>OBSCURE_CHECKS_ENAB
255CRACKLIB_DICTPATH
256PASS_CHANGE_TRIES
257PASS_ALWAYS_WARN</screen>
258
259</sect3>
260
261</sect2>
262
263</sect1>
Note: See TracBrowser for help on using the repository browser.