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