1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3CR2//EN" "http://www.docbook.org/xml/4.3CR2/docbookx.dtd" [
3 <!ENTITY % shadow-entities SYSTEM "../ent/shadow.ent">
6 <sect1 id="ch06-shadow">
7 <title>Installing Shadow-&shadow-version;</title>
8 <?dbhtml filename="shadow.html"?>
10 <screen>Estimated build time: 0.4 SBU
11 Estimated required disk space: 11 MB</screen>
13 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../appendixa/shadow-contents.xml"/>
16 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../appendixa/shadow-deps.xml"/>
21 <title>Installation of Shadow</title>
23 <para>The <userinput>login</userinput>, <userinput>getty</userinput> and
24 <userinput>init</userinput> programs (and some others) maintain a number
25 of logfiles to record who are and who were logged in to the system. These
26 programs, however, don't create these logfiles when they don't exist, so if
27 you want this logging to occur you will have to create the files yourself.
28 The Shadow package needs to detect these files in their proper place, so we
29 create them now, with their proper permissions:</para>
31 <screen><userinput>touch /var/run/utmp /var/log/{btmp,lastlog,wtmp}
32 chmod 644 /var/run/utmp /var/log/{btmp,lastlog,wtmp}</userinput></screen>
34 <para>The <filename>/var/run/utmp</filename> file lists the users that are
35 currently logged in, the <filename>/var/log/wtmp</filename> file who
36 <emphasis>were</emphasis> logged in and when.
37 The <filename>/var/log/lastlog</filename> file shows for each user when he
38 or she last logged in, and the <filename>/var/log/btmp</filename> lists the
39 bad login attempts.</para>
41 <para>Shadow hard-wires the path to the <userinput>passwd</userinput> binary
42 within the binary itself, but does this the wrong way. If a
43 <userinput>passwd</userinput> binary is not present before installing Shadow,
44 the package incorrectly assumes it is going to be located at
45 <filename>/bin/passwd</filename>, but then installs it in
46 <filename>/usr/bin/passwd</filename>. This will lead to errors about not finding
47 <filename>/bin/passwd</filename>. To work around this bug, create a dummy
48 <filename>passwd</filename> file, so that it gets hard-wired properly:</para>
50 <screen><userinput>touch /usr/bin/passwd</userinput></screen>
52 <para>The current Shadow suite has a problem that causes the
53 <userinput>newgrp</userinput> command to fail. The following patch (also
54 appearing in Shadow's CVS code) fixes this problem:</para>
56 <screen><userinput>patch -Np1 -i ../shadow-&shadow-version;-newgrp-fix.patch</userinput></screen>
58 <para>Now prepare Shadow for compilation:</para>
60 <screen><userinput>./configure --prefix=/usr --libdir=/usr/lib --enable-shared</userinput></screen>
62 <para>Compile the package:</para>
64 <screen><userinput>make</userinput></screen>
66 <para>And install it:</para>
68 <screen><userinput>make install</userinput></screen>
70 <para>Shadow uses two files to configure authentication settings for the
71 system. Install these two config files:</para>
73 <screen><userinput>cp etc/{limits,login.access} /etc</userinput></screen>
75 <para>We want to change the password method to enable MD5 passwords which are
76 theoretically more secure than the default "crypt" method and also allow
77 password lengths greater than 8 characters. We also need to change the old
78 <filename class="directory">/var/spool/mail</filename> location for user
79 mailboxes to the current location at
80 <filename class="directory">/var/mail</filename>. We do this by changing the
81 relevant configuration file while copying it to its destination:</para>
83 <screen><userinput>sed -e 's%/var/spool/mail%/var/mail%' \
84 -e 's%#MD5_CRYPT_ENAB.no%MD5_CRYPT_ENAB yes%' \
85 etc/login.defs.linux > /etc/login.defs</userinput></screen>
87 <note><para>Be extra careful when typing all of the above. It is probably safer
88 to cut-and-paste it rather than try and type it all in.</para></note>
90 <para>According to the man page of <userinput>vipw</userinput>, a
91 <userinput>vigr</userinput> program should exist too. Since the installation
92 procedure doesn't create this program, create a symlink manually:</para>
94 <screen><userinput>ln -s vipw /usr/sbin/vigr</userinput></screen>
96 <para>As the <filename>/bin/vipw</filename> symlink is redundant (and even
97 pointing to a non-existent file), remove it:</para>
99 <screen><userinput>rm /bin/vipw</userinput></screen>
101 <para>Now move the <userinput>sg</userinput> program to its proper place:</para>
103 <screen><userinput>mv /bin/sg /usr/bin</userinput></screen>
105 <para>And move Shadow's dynamic libraries to a more appropriate location:</para>
107 <screen><userinput>mv /usr/lib/lib{shadow,misc}.so.0* /lib</userinput></screen>
109 <para>As some packages expect to find the just-moved libraries in
110 <filename>/usr/lib</filename>, create the following symlinks:</para>
112 <screen><userinput>ln -sf ../../lib/libshadow.so.0 /usr/lib/libshadow.so
113 ln -sf ../../lib/libmisc.so.0 /usr/lib/libmisc.so</userinput></screen>
115 <para>The -D option of the <filename>useradd</filename> program requires this
116 directory for it to work properly:</para>
118 <screen><userinput>mkdir /etc/default</userinput></screen>
120 <para>Coreutils has already installed a <userinput>groups</userinput> program
121 in <filename>/usr/bin</filename>. If you wish, you can remove the one
122 installed by Shadow:</para>
124 <screen><userinput>rm /bin/groups</userinput></screen>
129 <sect2><title>Configuring Shadow</title>
131 <para>This package contains utilities to modify users' passwords, add
132 or delete users and groups, and the like. We're not going to explain what
133 'password shadowing' means. A full explanation can be found in the
134 <filename>doc/HOWTO</filename>
135 file within the unpacked Shadow source tree. There's one
136 thing to keep in mind if you decide to use Shadow support: programs that
137 need to verify passwords (for example xdm, ftp daemons, pop3 daemons) need
138 to be 'shadow-compliant', that is they need to be able to work with
139 shadowed passwords.</para>
141 <para>To enable shadowed passwords, run the following command:</para>
143 <screen><userinput>/usr/sbin/pwconv</userinput></screen>
145 <para>And to enable shadowed group passwords, run the following
148 <screen><userinput>/usr/sbin/grpconv</userinput></screen>
150 <para>Under normal circumstances, you won't have created any passwords yet.
151 However, if returning to this section to enable shadowing, you should reset any
152 current user passwords with the <userinput>passwd</userinput> command or any
153 group passwords with the <userinput>gpasswd</userinput> command.</para>
158 <title>Setting the root password</title>
160 <para>Choose a password for user root and set it by running the following
163 <screen><userinput>passwd root</userinput></screen>