shadow.xml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  4. <!ENTITY % general-entities SYSTEM "../general.ent">
  5. %general-entities;
  6. ]>
  7. <sect1 id="ch-system-shadow" role="wrap">
  8. <?dbhtml filename="shadow.html"?>
  9. <sect1info condition="script">
  10. <productname>shadow</productname>
  11. <productnumber>&shadow-version;</productnumber>
  12. <address>&shadow-url;</address>
  13. </sect1info>
  14. <title>Shadow-&shadow-version;</title>
  15. <indexterm zone="ch-system-shadow">
  16. <primary sortas="a-Shadow">Shadow</primary>
  17. </indexterm>
  18. <sect2 role="package">
  19. <title/>
  20. <para>The Shadow package contains programs for handling passwords in a secure
  21. way.</para>
  22. <segmentedlist>
  23. <segtitle>&buildtime;</segtitle>
  24. <segtitle>&diskspace;</segtitle>
  25. <seglistitem>
  26. <seg>&shadow-ch6-sbu;</seg>
  27. <seg>&shadow-ch6-du;</seg>
  28. </seglistitem>
  29. </segmentedlist>
  30. </sect2>
  31. <sect2 role="installation">
  32. <title>Installation of Shadow</title>
  33. <note>
  34. <para>If you would like to enforce the use of strong passwords, refer to
  35. <ulink url="&blfs-book;postlfs/cracklib.html"/> for installing
  36. CrackLib prior to building Shadow. Then add
  37. <parameter>--with-libcrack</parameter> to the <command>configure</command>
  38. command below.</para>
  39. </note>
  40. <para>Disable the installation of the <command>groups</command> program
  41. and its man pages, as Coreutils provides a better version. Also,
  42. prevent the installation of manual pages that were already installed in
  43. <xref linkend="ch-system-man-pages"/>:</para>
  44. <screen><userinput remap="pre">sed -i 's/groups$(EXEEXT) //' src/Makefile.in
  45. find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \;
  46. find man -name Makefile.in -exec sed -i 's/getspnam\.3 / /' {} \;
  47. find man -name Makefile.in -exec sed -i 's/passwd\.5 / /' {} \;</userinput></screen>
  48. <para id="shadow-login_defs">Instead of using the default
  49. <emphasis>crypt</emphasis> method, use the more secure
  50. <emphasis>SHA-512</emphasis> method of password encryption, which also
  51. allows passwords longer than 8 characters. It is also necessary to change
  52. the obsolete <filename class="directory">/var/spool/mail</filename> location
  53. for user mailboxes that Shadow uses by default to the <filename
  54. class="directory">/var/mail</filename> location used currently:</para>
  55. <screen><userinput remap="pre">sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@' \
  56. -e 's@/var/spool/mail@/var/mail@' etc/login.defs</userinput></screen>
  57. <note>
  58. <para>If you chose to build Shadow with Cracklib support, run the following:</para>
  59. <screen role="nodump"><userinput>sed -i 's@DICTPATH.*@DICTPATH\t/lib/cracklib/pw_dict@' etc/login.defs</userinput></screen>
  60. </note>
  61. <para>Make a minor change to make the first group number generated
  62. by useradd 1000:</para>
  63. <screen><userinput remap="pre">sed -i 's/1000/999/' etc/useradd</userinput></screen>
  64. <para>Prepare Shadow for compilation:</para>
  65. <screen><userinput remap="configure">./configure --sysconfdir=/etc --with-group-name-max-length=32</userinput></screen>
  66. <variablelist>
  67. <title>The meaning of the configure option:</title>
  68. <varlistentry>
  69. <term><parameter>--with-group-name-max-length=32</parameter></term>
  70. <listitem>
  71. <para>The maximum user name is 32 characters. Make the maximum
  72. group name the same.</para>
  73. </listitem>
  74. </varlistentry>
  75. </variablelist>
  76. <para>Compile the package:</para>
  77. <screen><userinput remap="make">make</userinput></screen>
  78. <para>This package does not come with a test suite.</para>
  79. <para>Install the package:</para>
  80. <screen><userinput remap="install">make install</userinput></screen>
  81. <!--
  82. <para>Move a misplaced program to its proper location:</para>
  83. <screen><userinput remap="install">mv -v /usr/bin/passwd /bin</userinput></screen>
  84. -->
  85. <!-- <para>Move Shadow's libraries to more appropriate locations:</para>
  86. <screen><userinput remap="install">mv -v /lib/libshadow.*a /usr/lib
  87. rm -v /lib/libshadow.so
  88. ln -sfv ../../lib/libshadow.so.0 /usr/lib/libshadow.so</userinput></screen> -->
  89. </sect2>
  90. <sect2 id="conf-shadow" role="configuration">
  91. <title>Configuring Shadow</title>
  92. <indexterm zone="conf-shadow">
  93. <primary sortas="a-Shadow">Shadow</primary>
  94. <secondary>configuring</secondary>
  95. </indexterm>
  96. <para>This package contains utilities to add, modify, and delete users and
  97. groups; set and change their passwords; and perform other administrative
  98. tasks. For a full explanation of what <emphasis>password shadowing</emphasis>
  99. means, see the <filename>doc/HOWTO</filename> file within the unpacked
  100. source tree. If using Shadow support, keep in mind that programs which need
  101. to verify passwords (display managers, FTP programs, pop3 daemons, etc.)
  102. must be Shadow-compliant. That is, they need to be able to work with
  103. shadowed passwords.</para>
  104. <para>To enable shadowed passwords, run the following command:</para>
  105. <screen><userinput>pwconv</userinput></screen>
  106. <para>To enable shadowed group passwords, run:</para>
  107. <screen><userinput>grpconv</userinput></screen>
  108. <para>Shadow's stock configuration for the <command>useradd</command>
  109. utility has a few caveats that need some explanation. First, the default
  110. action for the <command>useradd</command> utility is to create the user and
  111. a group of the same name as the user. By default the user ID (UID) and
  112. group ID (GID) numbers will begin with 1000. This means if you don't pass
  113. parameters to <command>useradd</command>, each user will be a member of a
  114. unique group on the system. If this behavior is undesirable, you'll need
  115. to pass the <parameter>-g</parameter> parameter to
  116. <command>useradd</command>. The default parameters are stored in the
  117. <filename>/etc/default/useradd</filename> file. You may need to modify two
  118. parameters in this file to suit your particular needs.</para>
  119. <variablelist>
  120. <title><filename>/etc/default/useradd</filename> Parameter Explanations</title>
  121. <varlistentry>
  122. <term><parameter>GROUP=1000</parameter></term>
  123. <listitem>
  124. <para>This parameter sets the beginning of the group numbers used in
  125. the /etc/group file. You can modify it to anything you desire. Note
  126. that <command>useradd</command> will never reuse a UID or GID. If the
  127. number identified in this parameter is used, it will use the next
  128. available number after this. Note also that if you don't have a group
  129. 1000 on your system the first time you use <command>useradd</command>
  130. without the <parameter>-g</parameter> parameter, you'll get a message
  131. displayed on the terminal that says:
  132. <computeroutput>useradd: unknown GID 1000</computeroutput>. You may
  133. disregard this message and group number 1000 will be used.</para>
  134. </listitem>
  135. </varlistentry>
  136. <varlistentry>
  137. <term><parameter>CREATE_MAIL_SPOOL=yes</parameter></term>
  138. <listitem>
  139. <para>This parameter causes <command>useradd</command> to create a
  140. mailbox file for the newly created user. <command>useradd</command>
  141. will make the group ownership of this file to the
  142. <systemitem class="groupname">mail</systemitem> group with 0660
  143. permissions. If you would prefer that these mailbox files are not
  144. created by <command>useradd</command>, issue the following
  145. command:</para>
  146. <screen><userinput>sed -i 's/yes/no/' /etc/default/useradd</userinput></screen>
  147. </listitem>
  148. </varlistentry>
  149. </variablelist>
  150. </sect2>
  151. <sect2 role="configuration">
  152. <title>Setting the root password</title>
  153. <para>Choose a password for user <emphasis>root</emphasis> and set it
  154. by running:</para>
  155. <screen role="nodump"><userinput>passwd root</userinput></screen>
  156. </sect2>
  157. <sect2 id="contents-shadow" role="content">
  158. <title>Contents of Shadow</title>
  159. <segmentedlist>
  160. <segtitle>Installed programs</segtitle>
  161. <segtitle>Installed directory</segtitle>
  162. <seglistitem>
  163. <seg>chage, chfn, chgpasswd, chpasswd, chsh, expiry, faillog, gpasswd,
  164. groupadd, groupdel, groupmems, groupmod, grpck, grpconv, grpunconv,
  165. lastlog, login, logoutd, newgidmap, newgrp, newuidmap, newusers,
  166. nologin, passwd, pwck, pwconv, pwunconv, sg (link to newgrp), su,
  167. useradd, userdel, usermod, vigr (link to vipw), and vipw</seg>
  168. <seg>/etc/default</seg>
  169. </seglistitem>
  170. </segmentedlist>
  171. <variablelist>
  172. <bridgehead renderas="sect3">Short Descriptions</bridgehead>
  173. <?dbfo list-presentation="list"?>
  174. <?dbhtml list-presentation="table"?>
  175. <varlistentry id="chage">
  176. <term><command>chage</command></term>
  177. <listitem>
  178. <para>Used to change the maximum number of days between obligatory
  179. password changes</para>
  180. <indexterm zone="ch-system-shadow chage">
  181. <primary sortas="b-chage">chage</primary>
  182. </indexterm>
  183. </listitem>
  184. </varlistentry>
  185. <varlistentry id="chfn">
  186. <term><command>chfn</command></term>
  187. <listitem>
  188. <para>Used to change a user's full name and other information</para>
  189. <indexterm zone="ch-system-shadow chfn">
  190. <primary sortas="b-chfn">chfn</primary>
  191. </indexterm>
  192. </listitem>
  193. </varlistentry>
  194. <varlistentry id="chgpasswd">
  195. <term><command>chgpasswd</command></term>
  196. <listitem>
  197. <para>Used to update group passwords in batch mode</para>
  198. <indexterm zone="ch-system-shadow chgpasswd">
  199. <primary sortas="b-chgpasswd">chgpasswd</primary>
  200. </indexterm>
  201. </listitem>
  202. </varlistentry>
  203. <varlistentry id="chpasswd">
  204. <term><command>chpasswd</command></term>
  205. <listitem>
  206. <para>Used to update user passwords in batch mode</para>
  207. <indexterm zone="ch-system-shadow chpasswd">
  208. <primary sortas="b-chpasswd">chpasswd</primary>
  209. </indexterm>
  210. </listitem>
  211. </varlistentry>
  212. <varlistentry id="chsh">
  213. <term><command>chsh</command></term>
  214. <listitem>
  215. <para>Used to change a user's default login shell</para>
  216. <indexterm zone="ch-system-shadow chsh">
  217. <primary sortas="b-chsh">chsh</primary>
  218. </indexterm>
  219. </listitem>
  220. </varlistentry>
  221. <varlistentry id="expiry">
  222. <term><command>expiry</command></term>
  223. <listitem>
  224. <para>Checks and enforces the current password expiration policy</para>
  225. <indexterm zone="ch-system-shadow expiry">
  226. <primary sortas="b-expiry">expiry</primary>
  227. </indexterm>
  228. </listitem>
  229. </varlistentry>
  230. <varlistentry id="faillog">
  231. <term><command>faillog</command></term>
  232. <listitem>
  233. <para>Is used to examine the log of login failures, to set a maximum
  234. number of failures before an account is blocked, or to reset the
  235. failure count</para>
  236. <indexterm zone="ch-system-shadow faillog">
  237. <primary sortas="b-faillog">faillog</primary>
  238. </indexterm>
  239. </listitem>
  240. </varlistentry>
  241. <varlistentry id="gpasswd">
  242. <term><command>gpasswd</command></term>
  243. <listitem>
  244. <para>Is used to add and delete members and administrators to
  245. groups</para>
  246. <indexterm zone="ch-system-shadow gpasswd">
  247. <primary sortas="b-gpasswd">gpasswd</primary>
  248. </indexterm>
  249. </listitem>
  250. </varlistentry>
  251. <varlistentry id="groupadd">
  252. <term><command>groupadd</command></term>
  253. <listitem>
  254. <para>Creates a group with the given name</para>
  255. <indexterm zone="ch-system-shadow groupadd">
  256. <primary sortas="b-groupadd">groupadd</primary>
  257. </indexterm>
  258. </listitem>
  259. </varlistentry>
  260. <varlistentry id="groupdel">
  261. <term><command>groupdel</command></term>
  262. <listitem>
  263. <para>Deletes the group with the given name</para>
  264. <indexterm zone="ch-system-shadow groupdel">
  265. <primary sortas="b-groupdel">groupdel</primary>
  266. </indexterm>
  267. </listitem>
  268. </varlistentry>
  269. <varlistentry id="groupmems">
  270. <term><command>groupmems</command></term>
  271. <listitem>
  272. <para>Allows a user to administer his/her own group membership list
  273. without the requirement of super user privileges.</para>
  274. <indexterm zone="ch-system-shadow groupmems">
  275. <primary sortas="b-groupmems">groupmems</primary>
  276. </indexterm>
  277. </listitem>
  278. </varlistentry>
  279. <varlistentry id="groupmod">
  280. <term><command>groupmod</command></term>
  281. <listitem>
  282. <para>Is used to modify the given group's name or GID</para>
  283. <indexterm zone="ch-system-shadow groupmod">
  284. <primary sortas="b-groupmod">groupmod</primary>
  285. </indexterm>
  286. </listitem>
  287. </varlistentry>
  288. <varlistentry id="grpck">
  289. <term><command>grpck</command></term>
  290. <listitem>
  291. <para>Verifies the integrity of the group files
  292. <filename>/etc/group</filename> and
  293. <filename>/etc/gshadow</filename></para>
  294. <indexterm zone="ch-system-shadow grpck">
  295. <primary sortas="b-grpck">grpck</primary>
  296. </indexterm>
  297. </listitem>
  298. </varlistentry>
  299. <varlistentry id="grpconv">
  300. <term><command>grpconv</command></term>
  301. <listitem>
  302. <para>Creates or updates the shadow group file from the normal
  303. group file</para>
  304. <indexterm zone="ch-system-shadow grpconv">
  305. <primary sortas="b-grpconv">grpconv</primary>
  306. </indexterm>
  307. </listitem>
  308. </varlistentry>
  309. <varlistentry id="grpunconv">
  310. <term><command>grpunconv</command></term>
  311. <listitem>
  312. <para>Updates <filename>/etc/group</filename> from
  313. <filename>/etc/gshadow</filename> and then deletes the latter</para>
  314. <indexterm zone="ch-system-shadow grpunconv">
  315. <primary sortas="b-grpunconv">grpunconv</primary>
  316. </indexterm>
  317. </listitem>
  318. </varlistentry>
  319. <varlistentry id="lastlog">
  320. <term><command>lastlog</command></term>
  321. <listitem>
  322. <para>Reports the most recent login of all users or of a
  323. given user</para>
  324. <indexterm zone="ch-system-shadow lastlog">
  325. <primary sortas="b-lastlog">lastlog</primary>
  326. </indexterm>
  327. </listitem>
  328. </varlistentry>
  329. <varlistentry id="login">
  330. <term><command>login</command></term>
  331. <listitem>
  332. <para>Is used by the system to let users sign on</para>
  333. <indexterm zone="ch-system-shadow login">
  334. <primary sortas="b-login">login</primary>
  335. </indexterm>
  336. </listitem>
  337. </varlistentry>
  338. <varlistentry id="logoutd">
  339. <term><command>logoutd</command></term>
  340. <listitem>
  341. <para>Is a daemon used to enforce restrictions on log-on time
  342. and ports</para>
  343. <indexterm zone="ch-system-shadow logoutd">
  344. <primary sortas="b-logoutd">logoutd</primary>
  345. </indexterm>
  346. </listitem>
  347. </varlistentry>
  348. <varlistentry id="newgidmap">
  349. <term><command>newgidmap</command></term>
  350. <listitem>
  351. <para>Is used to set the gid mapping of a user namespace</para>
  352. <indexterm zone="ch-system-shadow newgidmap">
  353. <primary sortas="b-newgidmap">newgidmap</primary>
  354. </indexterm>
  355. </listitem>
  356. </varlistentry>
  357. <varlistentry id="newgrp">
  358. <term><command>newgrp</command></term>
  359. <listitem>
  360. <para>Is used to change the current GID during a login session</para>
  361. <indexterm zone="ch-system-shadow newgrp">
  362. <primary sortas="b-newgrp">newgrp</primary>
  363. </indexterm>
  364. </listitem>
  365. </varlistentry>
  366. <varlistentry id="newuidmap">
  367. <term><command>newuidmap</command></term>
  368. <listitem>
  369. <para>Is used to set the uid mapping of a user namespace</para>
  370. <indexterm zone="ch-system-shadow newuidmap">
  371. <primary sortas="b-newuidmap">newuidmap</primary>
  372. </indexterm>
  373. </listitem>
  374. </varlistentry>
  375. <varlistentry id="newusers">
  376. <term><command>newusers</command></term>
  377. <listitem>
  378. <para>Is used to create or update an entire series of user
  379. accounts</para>
  380. <indexterm zone="ch-system-shadow newusers">
  381. <primary sortas="b-newusers">newusers</primary>
  382. </indexterm>
  383. </listitem>
  384. </varlistentry>
  385. <varlistentry id="nologin">
  386. <term><command>nologin</command></term>
  387. <listitem>
  388. <para>Displays a message that an account is not available; it is designed
  389. to be used as the default shell for accounts that have been
  390. disabled</para>
  391. <indexterm zone="ch-system-shadow nologin">
  392. <primary sortas="b-nologin">nologin</primary>
  393. </indexterm>
  394. </listitem>
  395. </varlistentry>
  396. <varlistentry id="passwd">
  397. <term><command>passwd</command></term>
  398. <listitem>
  399. <para>Is used to change the password for a user or group account</para>
  400. <indexterm zone="ch-system-shadow passwd">
  401. <primary sortas="b-passwd">passwd</primary>
  402. </indexterm>
  403. </listitem>
  404. </varlistentry>
  405. <varlistentry id="pwck">
  406. <term><command>pwck</command></term>
  407. <listitem>
  408. <para>Verifies the integrity of the password files
  409. <filename>/etc/passwd</filename> and
  410. <filename>/etc/shadow</filename></para>
  411. <indexterm zone="ch-system-shadow pwck">
  412. <primary sortas="b-pwck">pwck</primary>
  413. </indexterm>
  414. </listitem>
  415. </varlistentry>
  416. <varlistentry id="pwconv">
  417. <term><command>pwconv</command></term>
  418. <listitem>
  419. <para>Creates or updates the shadow password file from the normal
  420. password file</para>
  421. <indexterm zone="ch-system-shadow pwconv">
  422. <primary sortas="b-pwconv">pwconv</primary>
  423. </indexterm>
  424. </listitem>
  425. </varlistentry>
  426. <varlistentry id="pwunconv">
  427. <term><command>pwunconv</command></term>
  428. <listitem>
  429. <para>Updates <filename>/etc/passwd</filename> from
  430. <filename>/etc/shadow</filename> and then deletes the latter</para>
  431. <indexterm zone="ch-system-shadow pwunconv">
  432. <primary sortas="b-pwunconv">pwunconv</primary>
  433. </indexterm>
  434. </listitem>
  435. </varlistentry>
  436. <varlistentry id="sg">
  437. <term><command>sg</command></term>
  438. <listitem>
  439. <para>Executes a given command while the user's GID
  440. is set to that of the given group</para>
  441. <indexterm zone="ch-system-shadow sg">
  442. <primary sortas="b-sg">sg</primary>
  443. </indexterm>
  444. </listitem>
  445. </varlistentry>
  446. <varlistentry id="su">
  447. <term><command>su</command></term>
  448. <listitem>
  449. <para>Runs a shell with substitute user and group IDs</para>
  450. <indexterm zone="ch-system-shadow su">
  451. <primary sortas="b-su">su</primary>
  452. </indexterm>
  453. </listitem>
  454. </varlistentry>
  455. <varlistentry id="useradd">
  456. <term><command>useradd</command></term>
  457. <listitem>
  458. <para>Creates a new user with the given name, or updates the default
  459. new-user information</para>
  460. <indexterm zone="ch-system-shadow useradd">
  461. <primary sortas="b-useradd">useradd</primary>
  462. </indexterm>
  463. </listitem>
  464. </varlistentry>
  465. <varlistentry id="userdel">
  466. <term><command>userdel</command></term>
  467. <listitem>
  468. <para>Deletes the given user account</para>
  469. <indexterm zone="ch-system-shadow userdel">
  470. <primary sortas="b-userdel">userdel</primary>
  471. </indexterm>
  472. </listitem>
  473. </varlistentry>
  474. <varlistentry id="usermod">
  475. <term><command>usermod</command></term>
  476. <listitem>
  477. <para>Is used to modify the given user's login name, User
  478. Identification (UID), shell, initial group, home directory, etc.</para>
  479. <indexterm zone="ch-system-shadow usermod">
  480. <primary sortas="b-usermod">usermod</primary>
  481. </indexterm>
  482. </listitem>
  483. </varlistentry>
  484. <varlistentry id="vigr">
  485. <term><command>vigr</command></term>
  486. <listitem>
  487. <para>Edits the <filename>/etc/group</filename> or
  488. <filename>/etc/gshadow</filename> files</para>
  489. <indexterm zone="ch-system-shadow vigr">
  490. <primary sortas="b-vigr">vigr</primary>
  491. </indexterm>
  492. </listitem>
  493. </varlistentry>
  494. <varlistentry id="vipw">
  495. <term><command>vipw</command></term>
  496. <listitem>
  497. <para>Edits the <filename>/etc/passwd</filename> or
  498. <filename>/etc/shadow</filename> files</para>
  499. <indexterm zone="ch-system-shadow vipw">
  500. <primary sortas="b-vipw">vipw</primary>
  501. </indexterm>
  502. </listitem>
  503. </varlistentry>
  504. </variablelist>
  505. </sect2>
  506. </sect1>