shadow.xml 21 KB

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