* Fixed problem when BASEDIR paths were given without a trailing '/'.
[linux_from_scratch.git] / newxml / chapter06 / shadow.xml
blob76ea1f075f753d66333009d6d9258fe50b7d639b
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
3   <!ENTITY % general-entities SYSTEM "../general.ent">
4   %general-entities;
5 ]>
6 <sect1 id="ch-system-shadow" xreflabel="Shadow">
7 <title>Shadow-&shadow-version;</title>
8 <?dbhtml filename="shadow.html"?>
10 <indexterm zone="ch-system-shadow"><primary sortas="a-Shadow">Shadow</primary></indexterm>
12 <para>The Shadow package contains programs for handling passwords in a secure
13 way.</para>
15 <screen>&buildtime; 0.4 SBU
16 &diskspace; 11 MB</screen>
18 <para>Shadow installation depends on: Bash, Binutils, Bison, Coreutils,
19 Diffutils, GCC, Gettext, Glibc, Grep, Make, Sed.</para>
23 <sect2>
24 <title>Installation of Shadow</title>
26 <para>Shadow hard-wires the path to the <command>passwd</command> binary within
27 the binary itself, but does this the wrong way. If a <command>passwd</command>
28 binary is not present before installing Shadow, the package incorrectly assumes
29 it is going to be located at <filename>/bin/passwd</filename>, but then
30 installs it as <filename>/usr/bin/passwd</filename>. This will lead to errors
31 about not finding <filename>/bin/passwd</filename>. To work around this bug,
32 create a dummy <filename>passwd</filename> file, so that it gets hard-wired
33 properly:</para>
35 <screen><userinput>touch /usr/bin/passwd</userinput></screen>
37 <para>Now prepare Shadow for compilation:</para>
39 <screen><userinput>./configure --libdir=/usr/lib --enable-shared</userinput></screen>
41 <para>Work around a problem that prevents Shadow's internationalization from
42 working:</para>
44 <screen><userinput>echo '#define HAVE_SETLOCALE 1' &gt;&gt; config.h</userinput></screen>
46 <para>Compile the package:</para>
48 <screen><userinput>make</userinput></screen>
50 <para>Then install it:</para>
52 <screen><userinput>make install</userinput></screen>
54 <para>Shadow uses two files to configure authentication settings for the
55 system. Install these two config files:</para>
57 <screen><userinput>cp etc/{limits,login.access} /etc</userinput></screen>
59 <para>Instead of using the default <emphasis>crypt</emphasis> method, we want
60 to use the more secure <emphasis>MD5</emphasis> method of password encryption,
61 which also allows passwords longer than 8 characters. We also need to
62 change the obsolete <filename class="directory">/var/spool/mail</filename>
63 location for user mailboxes that Shadow uses by default to the <filename 
64 class="directory">/var/mail</filename> location used currently. We accomplish
65 both these things by changing the relevant configuration file while copying it
66 to its destination (it's probably better to cut-and-paste this rather than try
67 and type it all in):</para>
69 <screen><userinput>sed -e 's%#MD5_CRYPT_ENAB.no%MD5_CRYPT_ENAB yes%' \
70     -e 's%/var/spool/mail%/var/mail%' \
71     etc/login.defs.linux &gt; /etc/login.defs</userinput></screen>
73 <para>Move some misplaced symlinks to their proper locations:</para>
75 <screen><userinput>mv /bin/sg /usr/bin
76 mv /bin/vigr /usr/sbin</userinput></screen>
78 <para>And move Shadow's dynamic libraries to a more appropriate location:</para>
80 <screen><userinput>mv /usr/lib/lib{shadow,misc}.so.0* /lib</userinput></screen>
82 <para>As some packages expect to find the just-moved libraries in
83 <filename>/usr/lib</filename>, create the following symlinks:</para>
85 <screen><userinput>ln -sf ../../lib/libshadow.so.0 /usr/lib/libshadow.so
86 ln -sf ../../lib/libmisc.so.0 /usr/lib/libmisc.so</userinput></screen>
88 <para>The -D option of the <filename>useradd</filename> program requires this
89 directory for it to work properly:</para>
91 <screen><userinput>mkdir /etc/default</userinput></screen>
93 <para>Coreutils has already installed a better <command>groups</command>
94 program in <filename class="directory">/usr/bin</filename>. Remove the one
95 installed by Shadow:</para>
97 <screen><userinput>rm /bin/groups</userinput></screen>
99 </sect2>
102 <sect2 id="conf-shadow"><title>Configuring Shadow</title>
103 <indexterm zone="conf-shadow">
104 <primary sortas="a-Shadow">Shadow</primary>
105 <secondary>configuring</secondary></indexterm>
107 <para>This package contains utilities to add, modify and delete users and
108 groups, set and change their passwords, and other such administrative tasks.
109 For a full explanation of what <emphasis>password shadowing</emphasis> means,
110 see the <filename>doc/HOWTO</filename> file within the unpacked source tree.
111 There's one thing to keep in mind if you decide to use Shadow support: programs
112 that need to verify passwords (display managers, ftp programs, pop3 daemons,
113 and the like) need to be <emphasis>shadow-compliant</emphasis>, that is they
114 need to be able to work with shadowed passwords.</para>
116 <para>To enable shadowed passwords, run the following command:</para>
118 <screen><userinput>pwconv</userinput></screen>
120 <para>To enable shadowed group passwords, run:</para>
122 <screen><userinput>grpconv</userinput></screen>
124 <para>Under normal circumstances, you won't have created any passwords yet.
125 However, if returning to this section later to enable shadowing, you should
126 reset any current user passwords with the <command>passwd</command> command or
127 any group passwords with the <command>gpasswd</command> command.</para>
129 </sect2>
132 <sect2>
133 <title>Setting the root password</title>
135 <para>Choose a password for user root and set it via:</para>
137 <screen><userinput>passwd root</userinput></screen>
139 </sect2>
142 <sect2 id="contents-shadow"><title>Contents of Shadow</title>
144 <para><emphasis>Installed programs</emphasis>: chage, chfn, chpasswd, chsh,
145 dpasswd, expiry, faillog, gpasswd, groupadd, groupdel, groupmod, groups, grpck,
146 grpconv, grpunconv, lastlog, login, logoutd, mkpasswd, newgrp, newusers,
147 passwd, pwck, pwconv, pwunconv, sg (link to newgrp), useradd, userdel, usermod,
148 vigr (link to vipw) and vipw</para>
150 </sect2>
152 <sect2><title>Short descriptions</title>
154 <indexterm zone="ch-system-shadow chage"><primary sortas="b-chage">chage</primary></indexterm>
155 <para id="chage"><command>chage</command> is used to change the maximum number of
156 days between obligatory password changes.</para>
158 <indexterm zone="ch-system-shadow chfn"><primary sortas="b-chfn">chfn</primary></indexterm>
159 <para id="chfn"><command>chfn</command> is used to change a user's full name and
160 some other info.</para>
162 <indexterm zone="ch-system-shadow chpasswd"><primary sortas="b-chpasswd">chpasswd</primary></indexterm>
163 <para id="chpasswd"><command>chpasswd</command> is used to update the passwords of a
164 whole series of user accounts in one go.</para>
166 <indexterm zone="ch-system-shadow chsh"><primary sortas="b-chsh">chsh</primary></indexterm>
167 <para id="chsh"><command>chsh</command> is used to change a user's default
168  login shell.</para>
170 <indexterm zone="ch-system-shadow dpasswd"><primary sortas="b-dpasswd">dpasswd</primary></indexterm>
171 <para id="dpasswd"><command>dpasswd</command> is used to change dial-up passwords for
172 user login shells.</para>
174 <indexterm zone="ch-system-shadow expiry"><primary sortas="b-expiry">expiry</primary></indexterm>
175 <para id="expiry"><command>expiry</command> checks and enforces the current password
176 expiration policy.</para>
178 <indexterm zone="ch-system-shadow faillog"><primary sortas="b-faillog">faillog</primary></indexterm>
179 <para id="faillog"><command>faillog</command> is used to examine the log of login
180 failures, to set a maximum number of failures before an account is blocked,
181 or to reset the failure count.</para>
183 <indexterm zone="ch-system-shadow gpasswd"><primary sortas="b-gpasswd">gpasswd</primary></indexterm>
184 <para id="gpasswd"><command>gpasswd</command> is used to add and delete members and
185 administrators to groups.</para>
187 <indexterm zone="ch-system-shadow groupadd"><primary sortas="b-groupadd">groupadd</primary></indexterm>
188 <para id="groupadd"><command>groupadd</command> creates a group with the given
189 name.</para>
191 <indexterm zone="ch-system-shadow groupdel"><primary sortas="b-groupdel">groupdel</primary></indexterm>
192 <para id="groupdel"><command>groupdel</command> deletes the group with the given
193 name.</para>
195 <indexterm zone="ch-system-shadow groupmod"><primary sortas="b-groupmod">groupmod</primary></indexterm>
196 <para id="groupmod"><command>groupmod</command> is used to modify the given group's
197 name or GID.</para>
199 <indexterm zone="ch-system-shadow groups"><primary sortas="b-groups">groups</primary></indexterm>
200 <para id="groups"><command>groups</command> reports the groups of which the given
201 users are members.</para>
203 <indexterm zone="ch-system-shadow grpck"><primary sortas="b-grpck">grpck</primary></indexterm>
204 <para id="grpck"><command>grpck</command> verifies the integrity of the group files,
205 <filename>/etc/group</filename> and <filename>/etc/gshadow</filename>.</para>
207 <indexterm zone="ch-system-shadow grpconv"><primary sortas="b-grpconv">grpconv</primary></indexterm>
208 <para id="grpconv"><command>grpconv</command> creates or updates the shadow group file
209 from the normal group file.</para>
211 <indexterm zone="ch-system-shadow grpunconv"><primary sortas="b-grpunconv">grpunconv</primary></indexterm>
212 <para id="grpunconv"><command>grpunconv</command> updates <filename>/etc/group</filename>
213 from <filename>/etc/gshadow</filename> and then deletes the latter.</para>
215 <indexterm zone="ch-system-shadow lastlog"><primary sortas="b-lastlog">lastlog</primary></indexterm>
216 <para id="lastlog"><command>lastlog</command> reports the most recent login of all
217 users, or of a given user.</para>
219 <indexterm zone="ch-system-shadow login"><primary sortas="b-login">login</primary></indexterm>
220 <para id="login"><command>login</command> is used by the system to let users sign on.</para>
222 <indexterm zone="ch-system-shadow logoutd"><primary sortas="b-logoutd">logoutd</primary></indexterm>
223 <para id="logoutd"><command>logoutd</command> is a daemon used to enforce restrictions
224 on log-on time and ports.</para>
226 <indexterm zone="ch-system-shadow mkpasswd"><primary sortas="b-mkpasswd">mkpasswd</primary></indexterm>
227 <para id="mkpasswd"><command>mkpasswd</command> encrypts the given password using the
228 also given perturbation.</para>
230 <indexterm zone="ch-system-shadow newgrp"><primary sortas="b-newgrp">newgrp</primary></indexterm>
231 <para id="newgrp"><command>newgrp</command> is used to change the current GID during
232 a login session.</para>
234 <indexterm zone="ch-system-shadow newusers"><primary sortas="b-newusers">newusers</primary></indexterm>
235 <para id="newusers"><command>newusers</command> is used to create or update a whole
236 series of user accounts in one go.</para>
238 <indexterm zone="ch-system-shadow passwd"><primary sortas="b-passwd">passwd</primary></indexterm>
239 <para id="passwd"><command>passwd</command> is used to change the password for a user
240 or group account.</para>
242 <indexterm zone="ch-system-shadow pwck"><primary sortas="b-pwck">pwck</primary></indexterm>
243 <para id="pwck"><command>pwck</command> verifies the integrity of the password files,
244 <filename>/etc/passwd</filename> and <filename>/etc/shadow</filename>.</para>
246 <indexterm zone="ch-system-shadow pwconv"><primary sortas="b-pwconv">pwconv</primary></indexterm>
247 <para id="pwconv"><command>pwconv</command> creates or updates the shadow password file
248 from the normal password file.</para>
250 <indexterm zone="ch-system-shadow pwunconv"><primary sortas="b-pwunconv">pwunconv</primary></indexterm>
251 <para id="pwunconv"><command>pwunconv</command> updates <filename>/etc/passwd</filename>
252 from <filename>/etc/shadow</filename> and then deletes the latter.</para>
254 <indexterm zone="ch-system-shadow sg"><primary sortas="b-sg">sg</primary></indexterm>
255 <para id="sg"><command>sg</command> executes a given command while the user's GID
256 is set to that of the given group.</para>
258 <indexterm zone="ch-system-shadow useradd"><primary sortas="b-useradd">useradd</primary></indexterm>
259 <para id="useradd"><command>useradd</command> creates a new user with the given name,
260 or updates the default new-user information.</para>
262 <indexterm zone="ch-system-shadow userdel"><primary sortas="b-userdel">userdel</primary></indexterm>
263 <para id="userdel"><command>userdel</command> deletes the given user account.</para>
265 <indexterm zone="ch-system-shadow usermod"><primary sortas="b-usermod">usermod</primary></indexterm>
266 <para id="usermod"><command>usermod</command> is used to modify the given user's
267 login name, UID (User Identification), shell, initial group, home directory, and the like.</para>
269 <indexterm zone="ch-system-shadow vigr"><primary sortas="b-vigr">vigr</primary></indexterm>
270 <para id="vigr"><command>vigr</command> can be used to edit the
271 <filename>/etc/group</filename> or <filename>/etc/gshadow</filename>
272 files.</para>
274 <indexterm zone="ch-system-shadow vipw"><primary sortas="b-vipw">vipw</primary></indexterm>
275 <para id="vipw"><command>vipw</command> can be used to edit the
276 <filename>/etc/passwd</filename> or <filename>/etc/shadow</filename>
277 files.</para>
279 <indexterm zone="ch-system-shadow libmisc"><primary sortas="c-libmisc">libmisc</primary></indexterm>
280 <para id="libmisc"><command>libmisc</command>...</para>
282 <indexterm zone="ch-system-shadow libshadow"><primary sortas="c-libshadow">libshadow</primary></indexterm>
283 <para id="libshadow"><command>libshadow</command> contains functions used by most
284 programs in this package.</para>
286 </sect2>
290 </sect1>