[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 " ">
|
---|
[fbb96eb6] | 9 | <!ENTITY shadow-md5sum "723ebb19b06e2f52d9ed7f0653483851">
|
---|
| 10 | <!ENTITY shadow-size "1.5 MB">
|
---|
| 11 | <!ENTITY shadow-buildsize "46 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 |
|
---|
[82bdecf] | 44 | &lfs90_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 |
|
---|
[cac7f93] | 114 | <screen role="nodump"><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 &&
|
---|
[8f68b03] | 132 |
|
---|
[49ee2def] | 133 | ./configure --sysconfdir=/etc --with-group-name-max-length=32 &&
|
---|
[322f172] | 134 | make</userinput></screen>
|
---|
[17fb537e] | 135 |
|
---|
[9a3142c] | 136 | <para>
|
---|
| 137 | This package does not come with a test suite.
|
---|
| 138 | </para>
|
---|
[31f3a57] | 139 |
|
---|
[9a3142c] | 140 | <para>
|
---|
| 141 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
| 142 | </para>
|
---|
[17fb537e] | 143 |
|
---|
[fbb96eb6] | 144 | <screen role="root"><userinput>make install</userinput></screen>
|
---|
| 145 |
|
---|
[322f172] | 146 | </sect2>
|
---|
[b4b71892] | 147 |
|
---|
[322f172] | 148 | <sect2 role="commands">
|
---|
| 149 | <title>Command Explanations</title>
|
---|
[b4b71892] | 150 |
|
---|
[9a3142c] | 151 | <para>
|
---|
| 152 | <command>sed -i 's/groups$(EXEEXT) //' src/Makefile.in</command>: This sed
|
---|
| 153 | is used to suppress the installation of the <command>groups</command>
|
---|
| 154 | program as the version from the <application>Coreutils</application>
|
---|
| 155 | package installed during LFS is preferred.
|
---|
| 156 | </para>
|
---|
| 157 |
|
---|
| 158 | <para>
|
---|
| 159 | <command>find man -name Makefile.in -exec ... {} \;</command>: This
|
---|
| 160 | command is used to suppress the installation of the
|
---|
| 161 | <command>groups</command> man pages so the existing ones installed from
|
---|
| 162 | the <application>Coreutils</application> package are not replaced.
|
---|
| 163 | </para>
|
---|
| 164 |
|
---|
| 165 | <para>
|
---|
| 166 | <command>sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@' -e
|
---|
| 167 | 's@/var/spool/mail@/var/mail@' etc/login.defs</command>: Instead of using
|
---|
| 168 | the default 'DES' method, this command modifies the installation to use
|
---|
| 169 | the more secure 'SHA512' method of hashing passwords, which also allows
|
---|
| 170 | passwords longer than eight characters. It also changes the obsolete
|
---|
| 171 | <filename class="directory">/var/spool/mail</filename> location for user
|
---|
| 172 | mailboxes that <application>Shadow</application> uses by default to the
|
---|
| 173 | <filename class="directory">/var/mail</filename> location.
|
---|
| 174 | </para>
|
---|
| 175 |
|
---|
| 176 | <para>
|
---|
[f3429309] | 177 | <command>sed -i 's/1000/999/' etc/useradd</command>: Make a minor change
|
---|
[d64103f] | 178 | to make the default useradd consistent with the LFS groups file.
|
---|
[9a3142c] | 179 | </para>
|
---|
| 180 |
|
---|
[49ee2def] | 181 | <para>
|
---|
[f1d7196] | 182 | <parameter>--with-group-name-max-length=32</parameter>: The maximum
|
---|
| 183 | user name is 32 characters. Make the maximum group name the same.
|
---|
[49ee2def] | 184 | </para>
|
---|
| 185 |
|
---|
[fbb96eb6] | 186 | <!-- No longer needed as of 4.8
|
---|
[9a3142c] | 187 | <para>
|
---|
| 188 | <command>mv -v /usr/bin/passwd /bin</command>: The
|
---|
| 189 | <command>passwd</command> program may be needed during times when the
|
---|
| 190 | <filename class='directory'>/usr</filename> filesystem is not mounted so
|
---|
| 191 | it is moved into the root partition.
|
---|
| 192 | </para>
|
---|
[fbb96eb6] | 193 | -->
|
---|
| 194 |
|
---|
[322f172] | 195 | </sect2>
|
---|
[b4b71892] | 196 |
|
---|
[e807ae1d] | 197 | <sect2 role="configuration">
|
---|
| 198 | <title>Configuring Shadow</title>
|
---|
| 199 |
|
---|
[9a3142c] | 200 | <para>
|
---|
| 201 | <application>Shadow</application>'s stock configuration for the
|
---|
| 202 | <command>useradd</command> utility may not be desirable for your
|
---|
| 203 | installation. One default parameter causes <command>useradd</command> to
|
---|
| 204 | create a mailbox file for any newly created user.
|
---|
| 205 | <command>useradd</command> will make the group ownership of this file to
|
---|
| 206 | the <systemitem class="groupname">mail</systemitem> group with 0660
|
---|
| 207 | permissions. If you would prefer that these mailbox files are not created
|
---|
| 208 | by <command>useradd</command>, issue the following command as the
|
---|
| 209 | <systemitem class="username">root</systemitem> user:
|
---|
| 210 | </para>
|
---|
[e807ae1d] | 211 |
|
---|
[bca744f] | 212 | <screen role="root"><userinput>sed -i 's/yes/no/' /etc/default/useradd</userinput></screen>
|
---|
[e807ae1d] | 213 | </sect2>
|
---|
| 214 |
|
---|
[322f172] | 215 | <sect2 role="configuration">
|
---|
| 216 | <title>Configuring Linux-PAM to Work with Shadow</title>
|
---|
[b4b71892] | 217 |
|
---|
[8f68b03] | 218 | <note>
|
---|
[9a3142c] | 219 | <para>
|
---|
| 220 | The rest of this page is devoted to configuring
|
---|
| 221 | <application>Shadow</application> to work properly with
|
---|
| 222 | <application>Linux-PAM</application>. If you do not have
|
---|
| 223 | <application>Linux-PAM</application> installed, and you reinstalled
|
---|
| 224 | <application>Shadow</application> to support strong passwords via the
|
---|
| 225 | <application>CrackLib</application> library, no further configuration is
|
---|
| 226 | required.
|
---|
| 227 | </para>
|
---|
[8f68b03] | 228 | </note>
|
---|
| 229 |
|
---|
[322f172] | 230 | <sect3 id="pam.d">
|
---|
| 231 | <title>Config Files</title>
|
---|
[b4b71892] | 232 |
|
---|
[9a3142c] | 233 | <para>
|
---|
| 234 | <filename>/etc/pam.d/*</filename> or alternatively
|
---|
| 235 | <filename>/etc/pam.conf</filename>,
|
---|
| 236 | <filename>/etc/login.defs</filename> and
|
---|
| 237 | <filename>/etc/security/*</filename>
|
---|
| 238 | </para>
|
---|
[b4b71892] | 239 |
|
---|
[322f172] | 240 | <indexterm zone="shadow pam.d">
|
---|
| 241 | <primary sortas="e-etc-pam.d">/etc/pam.d/*</primary>
|
---|
| 242 | </indexterm>
|
---|
[2197589] | 243 |
|
---|
[322f172] | 244 | <indexterm zone="shadow pam.d">
|
---|
| 245 | <primary sortas="e-etc-pam.conf">/etc/pam.conf</primary>
|
---|
| 246 | </indexterm>
|
---|
[4fcf20a5] | 247 |
|
---|
[1ba671c] | 248 | <indexterm zone="shadow pam.d">
|
---|
| 249 | <primary sortas="e-etc-login.defs">/etc/login.defs</primary>
|
---|
| 250 | </indexterm>
|
---|
| 251 |
|
---|
| 252 | <indexterm zone="shadow pam.d">
|
---|
| 253 | <primary sortas="e-etc-security">/etc/security/*</primary>
|
---|
| 254 | </indexterm>
|
---|
[322f172] | 255 | </sect3>
|
---|
| 256 |
|
---|
| 257 | <sect3>
|
---|
| 258 | <title>Configuration Information</title>
|
---|
| 259 |
|
---|
[9a3142c] | 260 | <para>
|
---|
| 261 | Configuring your system to use <application>Linux-PAM</application> can
|
---|
| 262 | be a complex task. The information below will provide a basic setup so
|
---|
| 263 | that <application>Shadow</application>'s login and password
|
---|
| 264 | functionality will work effectively with
|
---|
| 265 | <application>Linux-PAM</application>. Review the information and links
|
---|
| 266 | on the <xref linkend="linux-pam"/> page for further configuration
|
---|
| 267 | information. For information specific to integrating
|
---|
| 268 | <application>Shadow</application>, <application>Linux-PAM</application>
|
---|
| 269 | and <application>CrackLib</application>, you can visit the following
|
---|
| 270 | link:
|
---|
| 271 | </para>
|
---|
[8f68b03] | 272 |
|
---|
| 273 | <itemizedlist spacing="compact">
|
---|
[9a3142c] | 274 | <listitem>
|
---|
[18f18c2] | 275 | <!-- New URL for the below link, according to it's author. -->
|
---|
[9a3142c] | 276 | <para>
|
---|
[18f18c2] | 277 | <ulink url="http://www.deer-run.com/~hal/linux_passwords_pam.html"/>
|
---|
[9a3142c] | 278 | </para>
|
---|
| 279 | </listitem>
|
---|
[8f68b03] | 280 | </itemizedlist>
|
---|
| 281 |
|
---|
[1ba671c] | 282 | <sect4 id="pam-login-defs">
|
---|
| 283 | <title>Configuring /etc/login.defs</title>
|
---|
| 284 |
|
---|
[9a3142c] | 285 | <para>
|
---|
| 286 | The <command>login</command> program currently performs many functions
|
---|
| 287 | which <application>Linux-PAM</application> modules should now handle.
|
---|
| 288 | The following <command>sed</command> command will comment out the
|
---|
| 289 | appropriate lines in <filename>/etc/login.defs</filename>, and stop
|
---|
| 290 | <command>login</command> from performing these functions (a backup
|
---|
| 291 | file named <filename>/etc/login.defs.orig</filename> is also created
|
---|
| 292 | to preserve the original file's contents). Issue the following
|
---|
| 293 | commands as the <systemitem class="username">root</systemitem> user:
|
---|
| 294 | </para>
|
---|
[1ba671c] | 295 |
|
---|
| 296 | <indexterm zone="shadow pam-login-defs">
|
---|
| 297 | <primary sortas="e-etc-login.defs">/etc/login.defs</primary>
|
---|
| 298 | </indexterm>
|
---|
| 299 |
|
---|
| 300 | <screen role="root"><userinput>install -v -m644 /etc/login.defs /etc/login.defs.orig &&
|
---|
[265c7da] | 301 | for FUNCTION in FAIL_DELAY \
|
---|
| 302 | FAILLOG_ENAB \
|
---|
| 303 | LASTLOG_ENAB \
|
---|
| 304 | MAIL_CHECK_ENAB \
|
---|
| 305 | OBSCURE_CHECKS_ENAB \
|
---|
| 306 | PORTTIME_CHECKS_ENAB \
|
---|
| 307 | QUOTAS_ENAB \
|
---|
| 308 | CONSOLE MOTD_FILE \
|
---|
| 309 | FTMP_FILE NOLOGINS_FILE \
|
---|
| 310 | ENV_HZ PASS_MIN_LEN \
|
---|
| 311 | SU_WHEEL_ONLY \
|
---|
| 312 | CRACKLIB_DICTPATH \
|
---|
| 313 | PASS_CHANGE_TRIES \
|
---|
| 314 | PASS_ALWAYS_WARN \
|
---|
[574d896d] | 315 | CHFN_AUTH ENCRYPT_METHOD \
|
---|
| 316 | ENVIRON_FILE
|
---|
[1ba671c] | 317 | do
|
---|
[9a3142c] | 318 | sed -i "s/^${FUNCTION}/# &/" /etc/login.defs
|
---|
[1ba671c] | 319 | done</userinput></screen>
|
---|
| 320 | </sect4>
|
---|
| 321 |
|
---|
| 322 | <sect4>
|
---|
| 323 | <title>Configuring the /etc/pam.d/ Files</title>
|
---|
| 324 |
|
---|
[9a3142c] | 325 | <para>
|
---|
| 326 | As mentioned previously in the <application>Linux-PAM</application>
|
---|
| 327 | instructions, <application>Linux-PAM</application> has two supported
|
---|
| 328 | methods for configuration. The commands below assume that you've
|
---|
| 329 | chosen to use a directory based configuration, where each program has
|
---|
| 330 | its own configuration file. You can optionally use a single
|
---|
| 331 | <filename>/etc/pam.conf</filename> configuration file by using the
|
---|
| 332 | text from the files below, and supplying the program name as an
|
---|
| 333 | additional first field for each line.
|
---|
| 334 | </para>
|
---|
[1ba671c] | 335 |
|
---|
[9a3142c] | 336 | <para>
|
---|
| 337 | As the <systemitem class="username">root</systemitem> user, replace
|
---|
| 338 | the following <application>Linux-PAM</application> configuration files
|
---|
| 339 | in the <filename class="directory">/etc/pam.d/</filename> directory
|
---|
| 340 | (or add the contents to the <filename>/etc/pam.conf</filename> file)
|
---|
| 341 | using the following commands:
|
---|
| 342 | </para>
|
---|
[1ba671c] | 343 | </sect4>
|
---|
[322f172] | 344 |
|
---|
| 345 | <sect4>
|
---|
[3e8fb4c] | 346 | <title>'login'</title>
|
---|
| 347 |
|
---|
| 348 | <screen role="root"><userinput>cat > /etc/pam.d/login << "EOF"
|
---|
| 349 | <literal># Begin /etc/pam.d/login
|
---|
| 350 |
|
---|
| 351 | # Set failure delay before next prompt to 3 seconds
|
---|
| 352 | auth optional pam_faildelay.so delay=3000000
|
---|
| 353 |
|
---|
| 354 | # Check to make sure that the user is allowed to login
|
---|
| 355 | auth requisite pam_nologin.so
|
---|
| 356 |
|
---|
[0d7900a] | 357 | # Check to make sure that root is allowed to login
|
---|
[d265d4c] | 358 | # Disabled by default. You will need to create /etc/securetty
|
---|
| 359 | # file for this module to function. See man 5 securetty.
|
---|
| 360 | #auth required pam_securetty.so
|
---|
[3e8fb4c] | 361 |
|
---|
| 362 | # Additional group memberships - disabled by default
|
---|
| 363 | #auth optional pam_group.so
|
---|
| 364 |
|
---|
[a5b9f1e] | 365 | # include system auth settings
|
---|
[3e8fb4c] | 366 | auth include system-auth
|
---|
| 367 |
|
---|
| 368 | # check access for the user
|
---|
| 369 | account required pam_access.so
|
---|
| 370 |
|
---|
[a5b9f1e] | 371 | # include system account settings
|
---|
[3e8fb4c] | 372 | account include system-account
|
---|
| 373 |
|
---|
| 374 | # Set default environment variables for the user
|
---|
| 375 | session required pam_env.so
|
---|
| 376 |
|
---|
| 377 | # Set resource limits for the user
|
---|
| 378 | session required pam_limits.so
|
---|
| 379 |
|
---|
| 380 | # Display date of last login - Disabled by default
|
---|
| 381 | #session optional pam_lastlog.so
|
---|
| 382 |
|
---|
| 383 | # Display the message of the day - Disabled by default
|
---|
| 384 | #session optional pam_motd.so
|
---|
| 385 |
|
---|
| 386 | # Check user's mail - Disabled by default
|
---|
| 387 | #session optional pam_mail.so standard quiet
|
---|
| 388 |
|
---|
[a5b9f1e] | 389 | # include system session and password settings
|
---|
[3e8fb4c] | 390 | session include system-session
|
---|
| 391 | password include system-password
|
---|
| 392 |
|
---|
| 393 | # End /etc/pam.d/login</literal>
|
---|
| 394 | EOF</userinput></screen>
|
---|
| 395 | </sect4>
|
---|
| 396 |
|
---|
| 397 | <sect4>
|
---|
| 398 | <title>'passwd'</title>
|
---|
[4fcf20a5] | 399 |
|
---|
[322f172] | 400 | <screen role="root"><userinput>cat > /etc/pam.d/passwd << "EOF"
|
---|
| 401 | <literal># Begin /etc/pam.d/passwd
|
---|
[4fcf20a5] | 402 |
|
---|
[3e8fb4c] | 403 | password include system-password
|
---|
[b4b71892] | 404 |
|
---|
[322f172] | 405 | # End /etc/pam.d/passwd</literal>
|
---|
| 406 | EOF</userinput></screen>
|
---|
| 407 | </sect4>
|
---|
[4fcf20a5] | 408 |
|
---|
[322f172] | 409 | <sect4>
|
---|
| 410 | <title>'su'</title>
|
---|
[4fcf20a5] | 411 |
|
---|
[322f172] | 412 | <screen role="root"><userinput>cat > /etc/pam.d/su << "EOF"
|
---|
| 413 | <literal># Begin /etc/pam.d/su
|
---|
[b4b71892] | 414 |
|
---|
[3e8fb4c] | 415 | # always allow root
|
---|
| 416 | auth sufficient pam_rootok.so
|
---|
[a5b9f1e] | 417 |
|
---|
| 418 | # Allow users in the wheel group to execute su without a password
|
---|
| 419 | # disabled by default
|
---|
| 420 | #auth sufficient pam_wheel.so trust use_uid
|
---|
| 421 |
|
---|
| 422 | # include system auth settings
|
---|
[55e18620] | 423 | auth include system-auth
|
---|
[3e8fb4c] | 424 |
|
---|
[a5b9f1e] | 425 | # limit su to users in the wheel group
|
---|
| 426 | auth required pam_wheel.so use_uid
|
---|
| 427 |
|
---|
| 428 | # include system account settings
|
---|
[3e8fb4c] | 429 | account include system-account
|
---|
| 430 |
|
---|
| 431 | # Set default environment variables for the service user
|
---|
| 432 | session required pam_env.so
|
---|
| 433 |
|
---|
[a5b9f1e] | 434 | # include system session settings
|
---|
[3e8fb4c] | 435 | session include system-session
|
---|
[b4b71892] | 436 |
|
---|
[322f172] | 437 | # End /etc/pam.d/su</literal>
|
---|
| 438 | EOF</userinput></screen>
|
---|
| 439 | </sect4>
|
---|
[b4b71892] | 440 |
|
---|
[322f172] | 441 | <sect4>
|
---|
| 442 | <title>'chage'</title>
|
---|
| 443 |
|
---|
| 444 | <screen role="root"><userinput>cat > /etc/pam.d/chage << "EOF"
|
---|
[2f12da13] | 445 | <literal># Begin /etc/pam.d/chage
|
---|
[3e8fb4c] | 446 |
|
---|
| 447 | # always allow root
|
---|
| 448 | auth sufficient pam_rootok.so
|
---|
| 449 |
|
---|
[a5b9f1e] | 450 | # include system auth, account, and session settings
|
---|
[3e8fb4c] | 451 | auth include system-auth
|
---|
| 452 | account include system-account
|
---|
| 453 | session include system-session
|
---|
[b4b71892] | 454 |
|
---|
[3e8fb4c] | 455 | # Always permit for authentication updates
|
---|
| 456 | password required pam_permit.so
|
---|
[b4b71892] | 457 |
|
---|
[322f172] | 458 | # End /etc/pam.d/chage</literal>
|
---|
| 459 | EOF</userinput></screen>
|
---|
| 460 | </sect4>
|
---|
[b4b71892] | 461 |
|
---|
[322f172] | 462 | <sect4>
|
---|
[265c7da] | 463 | <title>Other common programs</title>
|
---|
| 464 | <!--<title>'chfn', 'chgpasswd', 'chgpasswd', 'chsh', 'groupadd', 'groupdel',
|
---|
[9a3142c] | 465 | 'groupmems', 'groupmod', 'newusers', 'useradd', 'userdel' and
|
---|
[265c7da] | 466 | 'usermod'</title>-->
|
---|
[39975e9] | 467 |
|
---|
[bca744f] | 468 | <screen role="root"><userinput>for PROGRAM in chfn chgpasswd chpasswd chsh groupadd groupdel \
|
---|
| 469 | groupmems groupmod newusers useradd userdel usermod
|
---|
[4fcf20a5] | 470 | do
|
---|
[9a3142c] | 471 | install -v -m644 /etc/pam.d/chage /etc/pam.d/${PROGRAM}
|
---|
| 472 | sed -i "s/chage/$PROGRAM/" /etc/pam.d/${PROGRAM}
|
---|
[322f172] | 473 | done</userinput></screen>
|
---|
| 474 |
|
---|
[f586237] | 475 | <para revision="systemd">Because the installation of
|
---|
| 476 | <application>systemd</application> is not yet complete, you will need
|
---|
| 477 | to remove the <filename>/run/nologin</filename> file before testing the
|
---|
| 478 | installation. Execute the following command as the
|
---|
| 479 | <systemitem class="username">root</systemitem> user:</para>
|
---|
| 480 |
|
---|
| 481 | <screen role="root" revision="systemd"><userinput>rm -f /run/nologin</userinput></screen>
|
---|
| 482 |
|
---|
[7ab715e] | 483 | <note revision="systemd">
|
---|
[8cb62480] | 484 | <para>
|
---|
| 485 | If you are building <application>Shadow</application> with Linux-PAM,
|
---|
[7ab715e] | 486 | you should install <xref linkend="systemd"/> now.
|
---|
| 487 | Or due to the lack of <filename>systemd-user-sessions.service</filename>,
|
---|
| 488 | the <filename>/run/nologin</filename> file will prohibit the unprivileged
|
---|
| 489 | users to login into the system. If that happens you can still login
|
---|
| 490 | as <systemitem class="username">root</systemitem>.
|
---|
[8cb62480] | 491 | </para>
|
---|
[7ab715e] | 492 | </note>
|
---|
[8cb62480] | 493 |
|
---|
[322f172] | 494 | <warning>
|
---|
[9a3142c] | 495 | <para>
|
---|
| 496 | At this point, you should do a simple test to see if
|
---|
| 497 | <application>Shadow</application> is working as expected. Open
|
---|
| 498 | another terminal and log in as a user, then <command>su</command> to
|
---|
| 499 | <systemitem class="username">root</systemitem>. If you do not see
|
---|
| 500 | any errors, then all is well and you should proceed with the rest of
|
---|
| 501 | the configuration. If you did receive errors, stop now and double
|
---|
[e6ae99a] | 502 | check the above configuration files manually. One obvious reason
|
---|
| 503 | for an error is if the user is not in group <systemitem
|
---|
| 504 | class="groupname">wheel</systemitem>. You may want to run (as
|
---|
| 505 | <systemitem class="username">root</systemitem>): <command>usermod
|
---|
| 506 | -a -G wheel <replaceable><user></replaceable></command>.
|
---|
| 507 | Any other error is the sign of an error in the above procedure.
|
---|
| 508 | You can also run the
|
---|
[9a3142c] | 509 | test suite from the <application>Linux-PAM</application> package to
|
---|
| 510 | assist you in determining the problem. If you cannot find and fix
|
---|
| 511 | the error, you should recompile <application>Shadow</application>
|
---|
| 512 | adding the <option>--without-libpam</option> switch to the
|
---|
| 513 | <command>configure</command> command in the above instructions (also
|
---|
| 514 | move the <filename>/etc/login.defs.orig</filename> backup file to
|
---|
| 515 | <filename>/etc/login.defs</filename>). If you fail to do this and
|
---|
| 516 | the errors remain, you will be unable to log into your system.
|
---|
| 517 | </para>
|
---|
[322f172] | 518 | </warning>
|
---|
[349b53dd] | 519 | </sect4>
|
---|
| 520 |
|
---|
[322f172] | 521 | <sect4 id="pam-access">
|
---|
| 522 | <title>Configuring Login Access</title>
|
---|
[4fcf20a5] | 523 |
|
---|
[9a3142c] | 524 | <para>
|
---|
| 525 | Instead of using the <filename>/etc/login.access</filename> file for
|
---|
| 526 | controlling access to the system, <application>Linux-PAM</application>
|
---|
| 527 | uses the <filename class='libraryfile'>pam_access.so</filename> module
|
---|
| 528 | along with the <filename>/etc/security/access.conf</filename> file.
|
---|
| 529 | Rename the <filename>/etc/login.access</filename> file using the
|
---|
| 530 | following command:
|
---|
| 531 | </para>
|
---|
[322f172] | 532 |
|
---|
| 533 | <indexterm zone="shadow pam-access">
|
---|
| 534 | <primary sortas="e-etc-security-access.conf">/etc/security/access.conf</primary>
|
---|
| 535 | </indexterm>
|
---|
| 536 |
|
---|
[9a3142c] | 537 | <screen role="root"><userinput>[ -f /etc/login.access ] && mv -v /etc/login.access{,.NOUSE}</userinput></screen>
|
---|
[322f172] | 538 | </sect4>
|
---|
| 539 |
|
---|
| 540 | <sect4 id="pam-limits">
|
---|
| 541 | <title>Configuring Resource Limits</title>
|
---|
| 542 |
|
---|
[9a3142c] | 543 | <para>
|
---|
| 544 | Instead of using the <filename>/etc/limits</filename> file for
|
---|
| 545 | limiting usage of system resources,
|
---|
| 546 | <application>Linux-PAM</application> uses the
|
---|
| 547 | <filename class='libraryfile'>pam_limits.so</filename> module along
|
---|
| 548 | with the <filename>/etc/security/limits.conf</filename> file. Rename
|
---|
| 549 | the <filename>/etc/limits</filename> file using the following command:
|
---|
| 550 | </para>
|
---|
[322f172] | 551 |
|
---|
| 552 | <indexterm zone="shadow pam-limits">
|
---|
| 553 | <primary sortas="e-etc-security-limits.conf">/etc/security/limits.conf</primary>
|
---|
| 554 | </indexterm>
|
---|
| 555 |
|
---|
[9a3142c] | 556 | <screen role="root"><userinput>[ -f /etc/limits ] && mv -v /etc/limits{,.NOUSE}</userinput></screen>
|
---|
[74f20a1] | 557 |
|
---|
| 558 | <caution><para>Be sure to test the login capabilities of the system
|
---|
[d4f9cee] | 559 | before logging out. Errors in the configuration can cause a permanent
|
---|
[74f20a1] | 560 | lockout requiring a boot from an external source to correct the
|
---|
| 561 | problem.</para></caution>
|
---|
| 562 |
|
---|
[322f172] | 563 | </sect4>
|
---|
| 564 | </sect3>
|
---|
[74f20a1] | 565 |
|
---|
[322f172] | 566 | </sect2>
|
---|
[f45b1953] | 567 |
|
---|
[322f172] | 568 | <sect2 role="content">
|
---|
| 569 | <title>Contents</title>
|
---|
[17fb537e] | 570 |
|
---|
[9a3142c] | 571 | <para>
|
---|
| 572 | A list of the installed files, along with their short descriptions can be
|
---|
[f586237] | 573 | found at
|
---|
| 574 | <phrase revision="sysv">
|
---|
| 575 | <ulink url="&lfs-root;/chapter06/shadow.html#contents-shadow"/></phrase>
|
---|
| 576 | <phrase revision="systemd">
|
---|
| 577 | <ulink url="&lfs-rootd;/chapter06/shadow.html#contents-shadow"/></phrase>.
|
---|
[9a3142c] | 578 | </para>
|
---|
[c627795] | 579 |
|
---|
[322f172] | 580 | </sect2>
|
---|
[c627795] | 581 |
|
---|
[f45b1953] | 582 | </sect1>
|
---|