[b4b71892] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[6732c094] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
[b4b71892] | 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
[17fb537e] | 6 |
|
---|
[81d1117] | 7 | <!ENTITY shadow-download-http "https://github.com/shadow-maint/shadow/releases/download/&shadow-version;/shadow-&shadow-version;.tar.xz">
|
---|
[fb89293] | 8 | <!ENTITY shadow-download-ftp " ">
|
---|
[4af9931] | 9 | <!ENTITY shadow-md5sum "c06f8c2571b44899e60662f9ad259dd6">
|
---|
| 10 | <!ENTITY shadow-size "1.6 MB">
|
---|
| 11 | <!ENTITY shadow-buildsize "31 MB">
|
---|
[d64103f] | 12 | <!ENTITY shadow-time "0.2 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 |
|
---|
[9a3142c] | 32 | <para>
|
---|
| 33 | <application>Shadow</application> was indeed installed in LFS and there is
|
---|
| 34 | no reason to reinstall it unless you installed
|
---|
| 35 | <application>CrackLib</application> or
|
---|
| 36 | <application>Linux-PAM</application> after your LFS system was completed.
|
---|
| 37 | If you have installed <application>CrackLib</application> after LFS, then
|
---|
| 38 | reinstalling <application>Shadow</application> will enable strong password
|
---|
| 39 | support. If you have installed <application>Linux-PAM</application>,
|
---|
| 40 | reinstalling <application>Shadow</application> will allow programs such as
|
---|
| 41 | <command>login</command> and <command>su</command> to utilize PAM.
|
---|
| 42 | </para>
|
---|
[322f172] | 43 |
|
---|
[23fc1d1] | 44 | &lfs80_checked;
|
---|
[f4797d2] | 45 |
|
---|
[322f172] | 46 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
| 47 | <itemizedlist spacing="compact">
|
---|
| 48 | <listitem>
|
---|
[9a3142c] | 49 | <para>
|
---|
| 50 | Download (HTTP): <ulink url="&shadow-download-http;"/>
|
---|
| 51 | </para>
|
---|
[322f172] | 52 | </listitem>
|
---|
[29d1c248] | 53 | <listitem>
|
---|
[9a3142c] | 54 | <para>
|
---|
| 55 | Download (FTP): <ulink url="&shadow-download-ftp;"/>
|
---|
| 56 | </para>
|
---|
[29d1c248] | 57 | </listitem>
|
---|
[322f172] | 58 | <listitem>
|
---|
[9a3142c] | 59 | <para>
|
---|
| 60 | Download MD5 sum: &shadow-md5sum;
|
---|
| 61 | </para>
|
---|
[322f172] | 62 | </listitem>
|
---|
| 63 | <listitem>
|
---|
[9a3142c] | 64 | <para>
|
---|
| 65 | Download size: &shadow-size;
|
---|
| 66 | </para>
|
---|
[322f172] | 67 | </listitem>
|
---|
| 68 | <listitem>
|
---|
[9a3142c] | 69 | <para>
|
---|
| 70 | Estimated disk space required: &shadow-buildsize;
|
---|
| 71 | </para>
|
---|
[322f172] | 72 | </listitem>
|
---|
| 73 | <listitem>
|
---|
[9a3142c] | 74 | <para>
|
---|
| 75 | Estimated build time: &shadow-time;
|
---|
| 76 | </para>
|
---|
[322f172] | 77 | </listitem>
|
---|
| 78 | </itemizedlist>
|
---|
| 79 |
|
---|
| 80 | <bridgehead renderas="sect3">Shadow Dependencies</bridgehead>
|
---|
| 81 |
|
---|
| 82 | <bridgehead renderas="sect4">Required</bridgehead>
|
---|
[9a3142c] | 83 | <para role="required">
|
---|
| 84 | <xref linkend="linux-pam"/> or
|
---|
| 85 | <xref linkend="cracklib"/>
|
---|
| 86 | </para>
|
---|
| 87 |
|
---|
| 88 | <para condition="html" role="usernotes">
|
---|
| 89 | User Notes: <ulink url="&blfs-wiki;/shadow"/>
|
---|
| 90 | </para>
|
---|
[322f172] | 91 | </sect2>
|
---|
| 92 |
|
---|
| 93 | <sect2 role="installation">
|
---|
| 94 | <title>Installation of Shadow</title>
|
---|
| 95 |
|
---|
[c6bdcb0] | 96 | <important>
|
---|
[9a3142c] | 97 | <para>
|
---|
| 98 | The installation commands shown below are for installations where
|
---|
| 99 | <application>Linux-PAM</application> has been installed (with or
|
---|
| 100 | without a <application>CrackLib</application> installation) and
|
---|
| 101 | <application>Shadow</application> is being reinstalled to support the
|
---|
| 102 | <application>Linux-PAM</application> installation.
|
---|
| 103 | </para>
|
---|
| 104 |
|
---|
| 105 | <para>
|
---|
| 106 | If you are reinstalling <application>Shadow</application> to provide
|
---|
| 107 | strong password support using the <application>CrackLib</application>
|
---|
| 108 | library without using <application>Linux-PAM</application>, ensure you
|
---|
| 109 | add the <parameter>--with-libcrack</parameter> parameter to the
|
---|
| 110 | <command>configure</command> script below and also issue the following
|
---|
| 111 | command:
|
---|
| 112 | </para>
|
---|
[bca744f] | 113 |
|
---|
| 114 | <screen><userinput>sed -i 's@DICTPATH.*@DICTPATH\t/lib/cracklib/pw_dict@' etc/login.defs</userinput></screen>
|
---|
[c6bdcb0] | 115 | </important>
|
---|
| 116 |
|
---|
[9a3142c] | 117 | <para>
|
---|
| 118 | Reinstall <application>Shadow</application> by running the following
|
---|
| 119 | commands:
|
---|
| 120 | </para>
|
---|
[322f172] | 121 |
|
---|
[5443006d] | 122 | <screen><userinput>sed -i 's/groups$(EXEEXT) //' src/Makefile.in &&
|
---|
[4af9931] | 123 |
|
---|
| 124 | find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \; &&
|
---|
[dcf64b5f] | 125 | find man -name Makefile.in -exec sed -i 's/getspnam\.3 / /' {} \; &&
|
---|
| 126 | find man -name Makefile.in -exec sed -i 's/passwd\.5 / /' {} \; &&
|
---|
[e5b9fc73] | 127 |
|
---|
[a9af283] | 128 | sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@' \
|
---|
[5443006d] | 129 | -e 's@/var/spool/mail@/var/mail@' etc/login.defs &&
|
---|
| 130 |
|
---|
[4af9931] | 131 | sed -i 's/1000/999/' etc/useradd &&
|
---|
| 132 | sed -i -e '/snprintf/s@_msg,@_msg, 256,@' src/su.c &&
|
---|
| 133 | sed -i -e '47 d' -e '60,65 d' libmisc/myname.c &&
|
---|
[33c6126f] | 134 |
|
---|
[13c8ca6] | 135 | echo '--- src/useradd.c (old)
|
---|
| 136 | +++ src/useradd.c (new)
|
---|
| 137 | @@ -2027,6 +2027,8 @@
|
---|
| 138 | is_shadow_grp = sgr_file_present ();
|
---|
| 139 | #endif
|
---|
| 140 |
|
---|
| 141 | + get_defaults ();
|
---|
| 142 | +
|
---|
| 143 | process_flags (argc, argv);
|
---|
| 144 |
|
---|
| 145 | #ifdef ENABLE_SUBIDS
|
---|
| 146 | @@ -2036,8 +2038,6 @@
|
---|
| 147 | (!user_id || (user_id <= uid_max && user_id >= uid_min));
|
---|
| 148 | #endif /* ENABLE_SUBIDS */
|
---|
| 149 |
|
---|
| 150 | - get_defaults ();
|
---|
| 151 | -
|
---|
| 152 | #ifdef ACCT_TOOLS_SETUID
|
---|
| 153 | #ifdef USE_PAM
|
---|
| 154 | {' | patch -p0 -l &&
|
---|
[8f68b03] | 155 |
|
---|
[49ee2def] | 156 | ./configure --sysconfdir=/etc --with-group-name-max-length=32 &&
|
---|
[322f172] | 157 | make</userinput></screen>
|
---|
[17fb537e] | 158 |
|
---|
[9a3142c] | 159 | <para>
|
---|
| 160 | This package does not come with a test suite.
|
---|
| 161 | </para>
|
---|
[31f3a57] | 162 |
|
---|
[9a3142c] | 163 | <para>
|
---|
| 164 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
| 165 | </para>
|
---|
[17fb537e] | 166 |
|
---|
[322f172] | 167 | <screen role="root"><userinput>make install &&
|
---|
[bca744f] | 168 | mv -v /usr/bin/passwd /bin</userinput></screen>
|
---|
[322f172] | 169 | </sect2>
|
---|
[b4b71892] | 170 |
|
---|
[322f172] | 171 | <sect2 role="commands">
|
---|
| 172 | <title>Command Explanations</title>
|
---|
[b4b71892] | 173 |
|
---|
[9a3142c] | 174 | <para>
|
---|
| 175 | <command>sed -i 's/groups$(EXEEXT) //' src/Makefile.in</command>: This sed
|
---|
| 176 | is used to suppress the installation of the <command>groups</command>
|
---|
| 177 | program as the version from the <application>Coreutils</application>
|
---|
| 178 | package installed during LFS is preferred.
|
---|
| 179 | </para>
|
---|
| 180 |
|
---|
| 181 | <para>
|
---|
| 182 | <command>find man -name Makefile.in -exec ... {} \;</command>: This
|
---|
| 183 | command is used to suppress the installation of the
|
---|
| 184 | <command>groups</command> man pages so the existing ones installed from
|
---|
| 185 | the <application>Coreutils</application> package are not replaced.
|
---|
| 186 | </para>
|
---|
| 187 |
|
---|
| 188 | <para>
|
---|
| 189 | <command>sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@' -e
|
---|
| 190 | 's@/var/spool/mail@/var/mail@' etc/login.defs</command>: Instead of using
|
---|
| 191 | the default 'DES' method, this command modifies the installation to use
|
---|
| 192 | the more secure 'SHA512' method of hashing passwords, which also allows
|
---|
| 193 | passwords longer than eight characters. It also changes the obsolete
|
---|
| 194 | <filename class="directory">/var/spool/mail</filename> location for user
|
---|
| 195 | mailboxes that <application>Shadow</application> uses by default to the
|
---|
| 196 | <filename class="directory">/var/mail</filename> location.
|
---|
| 197 | </para>
|
---|
| 198 |
|
---|
| 199 | <para>
|
---|
[f3429309] | 200 | <command>sed -i 's/1000/999/' etc/useradd</command>: Make a minor change
|
---|
[d64103f] | 201 | to make the default useradd consistent with the LFS groups file.
|
---|
[9a3142c] | 202 | </para>
|
---|
| 203 |
|
---|
[4af9931] | 204 | <para>
|
---|
| 205 | <command>sed -i -e '/snprintf/s@_msg,@_msg, 256,@' src/su.c</command>: Fix
|
---|
| 206 | a build error that only occurs if <xref linkend="linux-pam"/> is detected
|
---|
| 207 | by <command>configure</command>.
|
---|
| 208 | </para>
|
---|
| 209 |
|
---|
| 210 | <para>
|
---|
| 211 | <command>sed -i '47 d' -e '60,65 d' libmisc/myname.c</command>: Apply
|
---|
| 212 | a security fix from upstream.
|
---|
| 213 | </para>
|
---|
| 214 |
|
---|
[13c8ca6] | 215 | <para>
|
---|
| 216 | <command>echo '--- ...</command>: This command illustrates another
|
---|
| 217 | way to apply patches. Without the patch, <command>useradd</command>
|
---|
| 218 | does not use the defaults in <filename>/etc/default/useradd</filename>.
|
---|
| 219 | </para>
|
---|
| 220 |
|
---|
[49ee2def] | 221 | <para>
|
---|
[f1d7196] | 222 | <parameter>--with-group-name-max-length=32</parameter>: The maximum
|
---|
| 223 | user name is 32 characters. Make the maximum group name the same.
|
---|
[49ee2def] | 224 | </para>
|
---|
| 225 |
|
---|
[9a3142c] | 226 | <para>
|
---|
| 227 | <command>mv -v /usr/bin/passwd /bin</command>: The
|
---|
| 228 | <command>passwd</command> program may be needed during times when the
|
---|
| 229 | <filename class='directory'>/usr</filename> filesystem is not mounted so
|
---|
| 230 | it is moved into the root partition.
|
---|
| 231 | </para>
|
---|
[322f172] | 232 | </sect2>
|
---|
[b4b71892] | 233 |
|
---|
[e807ae1d] | 234 | <sect2 role="configuration">
|
---|
| 235 | <title>Configuring Shadow</title>
|
---|
| 236 |
|
---|
[9a3142c] | 237 | <para>
|
---|
| 238 | <application>Shadow</application>'s stock configuration for the
|
---|
| 239 | <command>useradd</command> utility may not be desirable for your
|
---|
| 240 | installation. One default parameter causes <command>useradd</command> to
|
---|
| 241 | create a mailbox file for any newly created user.
|
---|
| 242 | <command>useradd</command> will make the group ownership of this file to
|
---|
| 243 | the <systemitem class="groupname">mail</systemitem> group with 0660
|
---|
| 244 | permissions. If you would prefer that these mailbox files are not created
|
---|
| 245 | by <command>useradd</command>, issue the following command as the
|
---|
| 246 | <systemitem class="username">root</systemitem> user:
|
---|
| 247 | </para>
|
---|
[e807ae1d] | 248 |
|
---|
[bca744f] | 249 | <screen role="root"><userinput>sed -i 's/yes/no/' /etc/default/useradd</userinput></screen>
|
---|
[e807ae1d] | 250 | </sect2>
|
---|
| 251 |
|
---|
[322f172] | 252 | <sect2 role="configuration">
|
---|
| 253 | <title>Configuring Linux-PAM to Work with Shadow</title>
|
---|
[b4b71892] | 254 |
|
---|
[8f68b03] | 255 | <note>
|
---|
[9a3142c] | 256 | <para>
|
---|
| 257 | The rest of this page is devoted to configuring
|
---|
| 258 | <application>Shadow</application> to work properly with
|
---|
| 259 | <application>Linux-PAM</application>. If you do not have
|
---|
| 260 | <application>Linux-PAM</application> installed, and you reinstalled
|
---|
| 261 | <application>Shadow</application> to support strong passwords via the
|
---|
| 262 | <application>CrackLib</application> library, no further configuration is
|
---|
| 263 | required.
|
---|
| 264 | </para>
|
---|
[8f68b03] | 265 | </note>
|
---|
| 266 |
|
---|
[322f172] | 267 | <sect3 id="pam.d">
|
---|
| 268 | <title>Config Files</title>
|
---|
[b4b71892] | 269 |
|
---|
[9a3142c] | 270 | <para>
|
---|
| 271 | <filename>/etc/pam.d/*</filename> or alternatively
|
---|
| 272 | <filename>/etc/pam.conf</filename>,
|
---|
| 273 | <filename>/etc/login.defs</filename> and
|
---|
| 274 | <filename>/etc/security/*</filename>
|
---|
| 275 | </para>
|
---|
[b4b71892] | 276 |
|
---|
[322f172] | 277 | <indexterm zone="shadow pam.d">
|
---|
| 278 | <primary sortas="e-etc-pam.d">/etc/pam.d/*</primary>
|
---|
| 279 | </indexterm>
|
---|
[2197589] | 280 |
|
---|
[322f172] | 281 | <indexterm zone="shadow pam.d">
|
---|
| 282 | <primary sortas="e-etc-pam.conf">/etc/pam.conf</primary>
|
---|
| 283 | </indexterm>
|
---|
[4fcf20a5] | 284 |
|
---|
[1ba671c] | 285 | <indexterm zone="shadow pam.d">
|
---|
| 286 | <primary sortas="e-etc-login.defs">/etc/login.defs</primary>
|
---|
| 287 | </indexterm>
|
---|
| 288 |
|
---|
| 289 | <indexterm zone="shadow pam.d">
|
---|
| 290 | <primary sortas="e-etc-security">/etc/security/*</primary>
|
---|
| 291 | </indexterm>
|
---|
[322f172] | 292 | </sect3>
|
---|
| 293 |
|
---|
| 294 | <sect3>
|
---|
| 295 | <title>Configuration Information</title>
|
---|
| 296 |
|
---|
[9a3142c] | 297 | <para>
|
---|
| 298 | Configuring your system to use <application>Linux-PAM</application> can
|
---|
| 299 | be a complex task. The information below will provide a basic setup so
|
---|
| 300 | that <application>Shadow</application>'s login and password
|
---|
| 301 | functionality will work effectively with
|
---|
| 302 | <application>Linux-PAM</application>. Review the information and links
|
---|
| 303 | on the <xref linkend="linux-pam"/> page for further configuration
|
---|
| 304 | information. For information specific to integrating
|
---|
| 305 | <application>Shadow</application>, <application>Linux-PAM</application>
|
---|
| 306 | and <application>CrackLib</application>, you can visit the following
|
---|
| 307 | link:
|
---|
| 308 | </para>
|
---|
[8f68b03] | 309 |
|
---|
| 310 | <itemizedlist spacing="compact">
|
---|
[9a3142c] | 311 | <listitem>
|
---|
| 312 | <para>
|
---|
| 313 | <ulink url="http://www.deer-run.com/~hal/sysadmin/pam_cracklib.html"/>
|
---|
| 314 | </para>
|
---|
| 315 | </listitem>
|
---|
[8f68b03] | 316 | </itemizedlist>
|
---|
| 317 |
|
---|
[1ba671c] | 318 | <sect4 id="pam-login-defs">
|
---|
| 319 | <title>Configuring /etc/login.defs</title>
|
---|
| 320 |
|
---|
[9a3142c] | 321 | <para>
|
---|
| 322 | The <command>login</command> program currently performs many functions
|
---|
| 323 | which <application>Linux-PAM</application> modules should now handle.
|
---|
| 324 | The following <command>sed</command> command will comment out the
|
---|
| 325 | appropriate lines in <filename>/etc/login.defs</filename>, and stop
|
---|
| 326 | <command>login</command> from performing these functions (a backup
|
---|
| 327 | file named <filename>/etc/login.defs.orig</filename> is also created
|
---|
| 328 | to preserve the original file's contents). Issue the following
|
---|
| 329 | commands as the <systemitem class="username">root</systemitem> user:
|
---|
| 330 | </para>
|
---|
[1ba671c] | 331 |
|
---|
| 332 | <indexterm zone="shadow pam-login-defs">
|
---|
| 333 | <primary sortas="e-etc-login.defs">/etc/login.defs</primary>
|
---|
| 334 | </indexterm>
|
---|
| 335 |
|
---|
| 336 | <screen role="root"><userinput>install -v -m644 /etc/login.defs /etc/login.defs.orig &&
|
---|
[265c7da] | 337 | for FUNCTION in FAIL_DELAY \
|
---|
| 338 | FAILLOG_ENAB \
|
---|
| 339 | LASTLOG_ENAB \
|
---|
| 340 | MAIL_CHECK_ENAB \
|
---|
| 341 | OBSCURE_CHECKS_ENAB \
|
---|
| 342 | PORTTIME_CHECKS_ENAB \
|
---|
| 343 | QUOTAS_ENAB \
|
---|
| 344 | CONSOLE MOTD_FILE \
|
---|
| 345 | FTMP_FILE NOLOGINS_FILE \
|
---|
| 346 | ENV_HZ PASS_MIN_LEN \
|
---|
| 347 | SU_WHEEL_ONLY \
|
---|
| 348 | CRACKLIB_DICTPATH \
|
---|
| 349 | PASS_CHANGE_TRIES \
|
---|
| 350 | PASS_ALWAYS_WARN \
|
---|
[574d896d] | 351 | CHFN_AUTH ENCRYPT_METHOD \
|
---|
| 352 | ENVIRON_FILE
|
---|
[1ba671c] | 353 | do
|
---|
[9a3142c] | 354 | sed -i "s/^${FUNCTION}/# &/" /etc/login.defs
|
---|
[1ba671c] | 355 | done</userinput></screen>
|
---|
| 356 | </sect4>
|
---|
| 357 |
|
---|
| 358 | <sect4>
|
---|
| 359 | <title>Configuring the /etc/pam.d/ Files</title>
|
---|
| 360 |
|
---|
[9a3142c] | 361 | <para>
|
---|
| 362 | As mentioned previously in the <application>Linux-PAM</application>
|
---|
| 363 | instructions, <application>Linux-PAM</application> has two supported
|
---|
| 364 | methods for configuration. The commands below assume that you've
|
---|
| 365 | chosen to use a directory based configuration, where each program has
|
---|
| 366 | its own configuration file. You can optionally use a single
|
---|
| 367 | <filename>/etc/pam.conf</filename> configuration file by using the
|
---|
| 368 | text from the files below, and supplying the program name as an
|
---|
| 369 | additional first field for each line.
|
---|
| 370 | </para>
|
---|
[1ba671c] | 371 |
|
---|
[9a3142c] | 372 | <para>
|
---|
| 373 | As the <systemitem class="username">root</systemitem> user, replace
|
---|
| 374 | the following <application>Linux-PAM</application> configuration files
|
---|
| 375 | in the <filename class="directory">/etc/pam.d/</filename> directory
|
---|
| 376 | (or add the contents to the <filename>/etc/pam.conf</filename> file)
|
---|
| 377 | using the following commands:
|
---|
| 378 | </para>
|
---|
[1ba671c] | 379 | </sect4>
|
---|
[322f172] | 380 |
|
---|
| 381 | <sect4>
|
---|
[3e8fb4c] | 382 | <title>'login'</title>
|
---|
| 383 |
|
---|
| 384 | <screen role="root"><userinput>cat > /etc/pam.d/login << "EOF"
|
---|
| 385 | <literal># Begin /etc/pam.d/login
|
---|
| 386 |
|
---|
| 387 | # Set failure delay before next prompt to 3 seconds
|
---|
| 388 | auth optional pam_faildelay.so delay=3000000
|
---|
| 389 |
|
---|
| 390 | # Check to make sure that the user is allowed to login
|
---|
| 391 | auth requisite pam_nologin.so
|
---|
| 392 |
|
---|
[0d7900a] | 393 | # Check to make sure that root is allowed to login
|
---|
[d265d4c] | 394 | # Disabled by default. You will need to create /etc/securetty
|
---|
| 395 | # file for this module to function. See man 5 securetty.
|
---|
| 396 | #auth required pam_securetty.so
|
---|
[3e8fb4c] | 397 |
|
---|
| 398 | # Additional group memberships - disabled by default
|
---|
| 399 | #auth optional pam_group.so
|
---|
| 400 |
|
---|
| 401 | # include the default auth settings
|
---|
| 402 | auth include system-auth
|
---|
| 403 |
|
---|
| 404 | # check access for the user
|
---|
| 405 | account required pam_access.so
|
---|
| 406 |
|
---|
| 407 | # include the default account settings
|
---|
| 408 | account include system-account
|
---|
| 409 |
|
---|
| 410 | # Set default environment variables for the user
|
---|
| 411 | session required pam_env.so
|
---|
| 412 |
|
---|
| 413 | # Set resource limits for the user
|
---|
| 414 | session required pam_limits.so
|
---|
| 415 |
|
---|
| 416 | # Display date of last login - Disabled by default
|
---|
| 417 | #session optional pam_lastlog.so
|
---|
| 418 |
|
---|
| 419 | # Display the message of the day - Disabled by default
|
---|
| 420 | #session optional pam_motd.so
|
---|
| 421 |
|
---|
| 422 | # Check user's mail - Disabled by default
|
---|
| 423 | #session optional pam_mail.so standard quiet
|
---|
| 424 |
|
---|
| 425 | # include the default session and password settings
|
---|
| 426 | session include system-session
|
---|
| 427 | password include system-password
|
---|
| 428 |
|
---|
| 429 | # End /etc/pam.d/login</literal>
|
---|
| 430 | EOF</userinput></screen>
|
---|
| 431 | </sect4>
|
---|
| 432 |
|
---|
| 433 | <sect4>
|
---|
| 434 | <title>'passwd'</title>
|
---|
[4fcf20a5] | 435 |
|
---|
[322f172] | 436 | <screen role="root"><userinput>cat > /etc/pam.d/passwd << "EOF"
|
---|
| 437 | <literal># Begin /etc/pam.d/passwd
|
---|
[4fcf20a5] | 438 |
|
---|
[3e8fb4c] | 439 | password include system-password
|
---|
[b4b71892] | 440 |
|
---|
[322f172] | 441 | # End /etc/pam.d/passwd</literal>
|
---|
| 442 | EOF</userinput></screen>
|
---|
| 443 | </sect4>
|
---|
[4fcf20a5] | 444 |
|
---|
[322f172] | 445 | <sect4>
|
---|
| 446 | <title>'su'</title>
|
---|
[4fcf20a5] | 447 |
|
---|
[322f172] | 448 | <screen role="root"><userinput>cat > /etc/pam.d/su << "EOF"
|
---|
| 449 | <literal># Begin /etc/pam.d/su
|
---|
[b4b71892] | 450 |
|
---|
[3e8fb4c] | 451 | # always allow root
|
---|
| 452 | auth sufficient pam_rootok.so
|
---|
[55e18620] | 453 | auth include system-auth
|
---|
[3e8fb4c] | 454 |
|
---|
| 455 | # include the default account settings
|
---|
| 456 | account include system-account
|
---|
| 457 |
|
---|
| 458 | # Set default environment variables for the service user
|
---|
| 459 | session required pam_env.so
|
---|
| 460 |
|
---|
| 461 | # include system session defaults
|
---|
| 462 | session include system-session
|
---|
[b4b71892] | 463 |
|
---|
[322f172] | 464 | # End /etc/pam.d/su</literal>
|
---|
| 465 | EOF</userinput></screen>
|
---|
| 466 | </sect4>
|
---|
[b4b71892] | 467 |
|
---|
[322f172] | 468 | <sect4>
|
---|
| 469 | <title>'chage'</title>
|
---|
| 470 |
|
---|
| 471 | <screen role="root"><userinput>cat > /etc/pam.d/chage << "EOF"
|
---|
[2f12da13] | 472 | <literal># Begin /etc/pam.d/chage
|
---|
[3e8fb4c] | 473 |
|
---|
| 474 | # always allow root
|
---|
| 475 | auth sufficient pam_rootok.so
|
---|
| 476 |
|
---|
| 477 | # include system defaults for auth account and session
|
---|
| 478 | auth include system-auth
|
---|
| 479 | account include system-account
|
---|
| 480 | session include system-session
|
---|
[b4b71892] | 481 |
|
---|
[3e8fb4c] | 482 | # Always permit for authentication updates
|
---|
| 483 | password required pam_permit.so
|
---|
[b4b71892] | 484 |
|
---|
[322f172] | 485 | # End /etc/pam.d/chage</literal>
|
---|
| 486 | EOF</userinput></screen>
|
---|
| 487 | </sect4>
|
---|
[b4b71892] | 488 |
|
---|
[322f172] | 489 | <sect4>
|
---|
[265c7da] | 490 | <title>Other common programs</title>
|
---|
| 491 | <!--<title>'chfn', 'chgpasswd', 'chgpasswd', 'chsh', 'groupadd', 'groupdel',
|
---|
[9a3142c] | 492 | 'groupmems', 'groupmod', 'newusers', 'useradd', 'userdel' and
|
---|
[265c7da] | 493 | 'usermod'</title>-->
|
---|
[39975e9] | 494 |
|
---|
[bca744f] | 495 | <screen role="root"><userinput>for PROGRAM in chfn chgpasswd chpasswd chsh groupadd groupdel \
|
---|
| 496 | groupmems groupmod newusers useradd userdel usermod
|
---|
[4fcf20a5] | 497 | do
|
---|
[9a3142c] | 498 | install -v -m644 /etc/pam.d/chage /etc/pam.d/${PROGRAM}
|
---|
| 499 | sed -i "s/chage/$PROGRAM/" /etc/pam.d/${PROGRAM}
|
---|
[322f172] | 500 | done</userinput></screen>
|
---|
| 501 |
|
---|
[f586237] | 502 | <para revision="systemd">Because the installation of
|
---|
| 503 | <application>systemd</application> is not yet complete, you will need
|
---|
| 504 | to remove the <filename>/run/nologin</filename> file before testing the
|
---|
| 505 | installation. Execute the following command as the
|
---|
| 506 | <systemitem class="username">root</systemitem> user:</para>
|
---|
| 507 |
|
---|
| 508 | <screen role="root" revision="systemd"><userinput>rm -f /run/nologin</userinput></screen>
|
---|
| 509 |
|
---|
[322f172] | 510 | <warning>
|
---|
[9a3142c] | 511 | <para>
|
---|
| 512 | At this point, you should do a simple test to see if
|
---|
| 513 | <application>Shadow</application> is working as expected. Open
|
---|
| 514 | another terminal and log in as a user, then <command>su</command> to
|
---|
| 515 | <systemitem class="username">root</systemitem>. If you do not see
|
---|
| 516 | any errors, then all is well and you should proceed with the rest of
|
---|
| 517 | the configuration. If you did receive errors, stop now and double
|
---|
| 518 | check the above configuration files manually. You can also run the
|
---|
| 519 | test suite from the <application>Linux-PAM</application> package to
|
---|
| 520 | assist you in determining the problem. If you cannot find and fix
|
---|
| 521 | the error, you should recompile <application>Shadow</application>
|
---|
| 522 | adding the <option>--without-libpam</option> switch to the
|
---|
| 523 | <command>configure</command> command in the above instructions (also
|
---|
| 524 | move the <filename>/etc/login.defs.orig</filename> backup file to
|
---|
| 525 | <filename>/etc/login.defs</filename>). If you fail to do this and
|
---|
| 526 | the errors remain, you will be unable to log into your system.
|
---|
| 527 | </para>
|
---|
[322f172] | 528 | </warning>
|
---|
[349b53dd] | 529 | </sect4>
|
---|
| 530 |
|
---|
[322f172] | 531 | <sect4 id="pam-access">
|
---|
| 532 | <title>Configuring Login Access</title>
|
---|
[4fcf20a5] | 533 |
|
---|
[9a3142c] | 534 | <para>
|
---|
| 535 | Instead of using the <filename>/etc/login.access</filename> file for
|
---|
| 536 | controlling access to the system, <application>Linux-PAM</application>
|
---|
| 537 | uses the <filename class='libraryfile'>pam_access.so</filename> module
|
---|
| 538 | along with the <filename>/etc/security/access.conf</filename> file.
|
---|
| 539 | Rename the <filename>/etc/login.access</filename> file using the
|
---|
| 540 | following command:
|
---|
| 541 | </para>
|
---|
[322f172] | 542 |
|
---|
| 543 | <indexterm zone="shadow pam-access">
|
---|
| 544 | <primary sortas="e-etc-security-access.conf">/etc/security/access.conf</primary>
|
---|
| 545 | </indexterm>
|
---|
| 546 |
|
---|
[9a3142c] | 547 | <screen role="root"><userinput>[ -f /etc/login.access ] && mv -v /etc/login.access{,.NOUSE}</userinput></screen>
|
---|
[322f172] | 548 | </sect4>
|
---|
| 549 |
|
---|
| 550 | <sect4 id="pam-limits">
|
---|
| 551 | <title>Configuring Resource Limits</title>
|
---|
| 552 |
|
---|
[9a3142c] | 553 | <para>
|
---|
| 554 | Instead of using the <filename>/etc/limits</filename> file for
|
---|
| 555 | limiting usage of system resources,
|
---|
| 556 | <application>Linux-PAM</application> uses the
|
---|
| 557 | <filename class='libraryfile'>pam_limits.so</filename> module along
|
---|
| 558 | with the <filename>/etc/security/limits.conf</filename> file. Rename
|
---|
| 559 | the <filename>/etc/limits</filename> file using the following command:
|
---|
| 560 | </para>
|
---|
[322f172] | 561 |
|
---|
| 562 | <indexterm zone="shadow pam-limits">
|
---|
| 563 | <primary sortas="e-etc-security-limits.conf">/etc/security/limits.conf</primary>
|
---|
| 564 | </indexterm>
|
---|
| 565 |
|
---|
[9a3142c] | 566 | <screen role="root"><userinput>[ -f /etc/limits ] && mv -v /etc/limits{,.NOUSE}</userinput></screen>
|
---|
[74f20a1] | 567 |
|
---|
| 568 | <caution><para>Be sure to test the login capabilities of the system
|
---|
[d4f9cee] | 569 | before logging out. Errors in the configuration can cause a permanent
|
---|
[74f20a1] | 570 | lockout requiring a boot from an external source to correct the
|
---|
| 571 | problem.</para></caution>
|
---|
| 572 |
|
---|
[322f172] | 573 | </sect4>
|
---|
| 574 | </sect3>
|
---|
[74f20a1] | 575 |
|
---|
[322f172] | 576 | </sect2>
|
---|
[f45b1953] | 577 |
|
---|
[322f172] | 578 | <sect2 role="content">
|
---|
| 579 | <title>Contents</title>
|
---|
[17fb537e] | 580 |
|
---|
[9a3142c] | 581 | <para>
|
---|
| 582 | A list of the installed files, along with their short descriptions can be
|
---|
[f586237] | 583 | found at
|
---|
| 584 | <phrase revision="sysv">
|
---|
| 585 | <ulink url="&lfs-root;/chapter06/shadow.html#contents-shadow"/></phrase>
|
---|
| 586 | <phrase revision="systemd">
|
---|
| 587 | <ulink url="&lfs-rootd;/chapter06/shadow.html#contents-shadow"/></phrase>.
|
---|
[9a3142c] | 588 | </para>
|
---|
[c627795] | 589 |
|
---|
[322f172] | 590 | </sect2>
|
---|
[c627795] | 591 |
|
---|
[f45b1953] | 592 | </sect1>
|
---|