shadow.xml 22 KB

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