pam_unix.8.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. <?xml version="1.0" encoding='UTF-8'?>
  2. <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
  4. <refentry id="pam_unix">
  5. <refmeta>
  6. <refentrytitle>pam_unix</refentrytitle>
  7. <manvolnum>8</manvolnum>
  8. <refmiscinfo class="sectdesc">Linux-PAM Manual</refmiscinfo>
  9. </refmeta>
  10. <refnamediv id="pam_unix-name">
  11. <refname>pam_unix</refname>
  12. <refpurpose>Module for traditional password authentication</refpurpose>
  13. </refnamediv>
  14. <refsynopsisdiv>
  15. <cmdsynopsis id="pam_unix-cmdsynopsis">
  16. <command>pam_unix.so</command>
  17. <arg choice="opt">
  18. ...
  19. </arg>
  20. </cmdsynopsis>
  21. </refsynopsisdiv>
  22. <refsect1 id="pam_unix-description">
  23. <title>DESCRIPTION</title>
  24. <para>
  25. This is the standard Unix authentication module. It uses standard
  26. calls from the system's libraries to retrieve and set account
  27. information as well as authentication. Usually this is obtained
  28. from the /etc/passwd and the /etc/shadow file as well if shadow is
  29. enabled.
  30. </para>
  31. <para>
  32. The account component performs the task of establishing the status
  33. of the user's account and password based on the following
  34. <emphasis>shadow</emphasis> elements: expire, last_change, max_change,
  35. min_change, warn_change. In the case of the latter, it may offer advice
  36. to the user on changing their password or, through the
  37. <emphasis remap='B'>PAM_AUTHTOKEN_REQD</emphasis> return, delay
  38. giving service to the user until they have established a new password.
  39. The entries listed above are documented in the <citerefentry>
  40. <refentrytitle>shadow</refentrytitle><manvolnum>5</manvolnum>
  41. </citerefentry> manual page. Should the user's record not contain
  42. one or more of these entries, the corresponding
  43. <emphasis>shadow</emphasis> check is not performed.
  44. </para>
  45. <para>
  46. The authentication component performs the task of checking the
  47. users credentials (password). The default action of this module
  48. is to not permit the user access to a service if their official
  49. password is blank.
  50. </para>
  51. <para>
  52. A helper binary, <citerefentry>
  53. <refentrytitle>unix_chkpwd</refentrytitle><manvolnum>8</manvolnum>
  54. </citerefentry>, is provided
  55. to check the user's password when it is stored in a read
  56. protected database. This binary is very simple and will only
  57. check the password of the user invoking it. It is called
  58. transparently on behalf of the user by the authenticating
  59. component of this module. In this way it is possible
  60. for applications like <citerefentry>
  61. <refentrytitle>xlock</refentrytitle><manvolnum>1</manvolnum>
  62. </citerefentry> to work without
  63. being setuid-root. The module, by default, will temporarily turn
  64. off SIGCHLD handling for the duration of execution of the helper
  65. binary. This is generally the right thing to do, as many applications
  66. are not prepared to handle this signal from a child they didn't know
  67. was <function>fork()</function>d. The <option>noreap</option> module
  68. argument can be used to suppress this temporary shielding and may be
  69. needed for use with certain applications.
  70. </para>
  71. <para>
  72. The maximum length of a password supported by the pam_unix module
  73. via the helper binary is <emphasis>PAM_MAX_RESP_SIZE</emphasis>
  74. - currently 512 bytes. The rest of the password provided by the
  75. conversation function to the module will be ignored.
  76. </para>
  77. <para>
  78. The password component of this module performs the task of updating
  79. the user's password. The default encryption hash is taken from the
  80. <emphasis remap='B'>ENCRYPT_METHOD</emphasis> variable from
  81. <emphasis>/etc/login.defs</emphasis>
  82. </para>
  83. <para>
  84. The session component of this module logs when a user logins
  85. or leave the system.
  86. </para>
  87. <para>
  88. Remaining arguments, supported by others functions of this
  89. module, are silently ignored. Other arguments are logged as
  90. errors through <citerefentry>
  91. <refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum>
  92. </citerefentry>.
  93. </para>
  94. </refsect1>
  95. <refsect1 id="pam_unix-options">
  96. <title>OPTIONS</title>
  97. <variablelist>
  98. <varlistentry>
  99. <term>
  100. <option>debug</option>
  101. </term>
  102. <listitem>
  103. <para>
  104. Turns on debugging via
  105. <citerefentry>
  106. <refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum>
  107. </citerefentry>.
  108. </para>
  109. </listitem>
  110. </varlistentry>
  111. <varlistentry>
  112. <term>
  113. <option>audit</option>
  114. </term>
  115. <listitem>
  116. <para>
  117. A little more extreme than debug.
  118. </para>
  119. </listitem>
  120. </varlistentry>
  121. <varlistentry>
  122. <term>
  123. <option>quiet</option>
  124. </term>
  125. <listitem>
  126. <para>
  127. Turns off informational messages namely messages about
  128. session open and close via
  129. <citerefentry>
  130. <refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum>
  131. </citerefentry>.
  132. </para>
  133. </listitem>
  134. </varlistentry>
  135. <varlistentry>
  136. <term>
  137. <option>nullok</option>
  138. </term>
  139. <listitem>
  140. <para>
  141. The default action of this module is to not permit the
  142. user access to a service if their official password is blank.
  143. The <option>nullok</option> argument overrides this default.
  144. </para>
  145. </listitem>
  146. </varlistentry>
  147. <varlistentry>
  148. <term>
  149. <option>nullresetok</option>
  150. </term>
  151. <listitem>
  152. <para>
  153. Allow users to authenticate with blank password if password reset
  154. is enforced even if <option>nullok</option> is not set. If password
  155. reset is not required and <option>nullok</option> is not set the
  156. authentication with blank password will be denied.
  157. </para>
  158. </listitem>
  159. </varlistentry>
  160. <varlistentry>
  161. <term>
  162. <option>try_first_pass</option>
  163. </term>
  164. <listitem>
  165. <para>
  166. Before prompting the user for their password, the module first
  167. tries the previous stacked module's password in case that
  168. satisfies this module as well.
  169. </para>
  170. </listitem>
  171. </varlistentry>
  172. <varlistentry>
  173. <term>
  174. <option>use_first_pass</option>
  175. </term>
  176. <listitem>
  177. <para>
  178. The argument <option>use_first_pass</option> forces the module
  179. to use a previous stacked modules password and will never prompt
  180. the user - if no password is available or the password is not
  181. appropriate, the user will be denied access.
  182. </para>
  183. </listitem>
  184. </varlistentry>
  185. <varlistentry>
  186. <term>
  187. <option>nodelay</option>
  188. </term>
  189. <listitem>
  190. <para>
  191. This argument can be used to discourage the authentication
  192. component from requesting a delay should the authentication
  193. as a whole fail. The default action is for the module to
  194. request a delay-on-failure of the order of two second.
  195. </para>
  196. </listitem>
  197. </varlistentry>
  198. <varlistentry>
  199. <term>
  200. <option>use_authtok</option>
  201. </term>
  202. <listitem>
  203. <para>
  204. When password changing enforce the module to set the new
  205. password to the one provided by a previously stacked
  206. <option>password</option> module (this is used in the
  207. example of the stacking of the <command>pam_passwdqc</command>
  208. module documented below).
  209. </para>
  210. </listitem>
  211. </varlistentry>
  212. <varlistentry>
  213. <term>
  214. <option>authtok_type=<replaceable>type</replaceable></option>
  215. </term>
  216. <listitem>
  217. <para>
  218. This argument can be used to modify the password prompt
  219. when changing passwords to include the type of the password.
  220. Empty by default.
  221. </para>
  222. </listitem>
  223. </varlistentry>
  224. <varlistentry>
  225. <term>
  226. <option>nis</option>
  227. </term>
  228. <listitem>
  229. <para>
  230. NIS RPC is used for setting new passwords.
  231. </para>
  232. </listitem>
  233. </varlistentry>
  234. <varlistentry>
  235. <term>
  236. <option>remember=<replaceable>n</replaceable></option>
  237. </term>
  238. <listitem>
  239. <para>
  240. The last <replaceable>n</replaceable> passwords for each
  241. user are saved in <filename>/etc/security/opasswd</filename>
  242. in order to force password change history and keep the user
  243. from alternating between the same password too frequently.
  244. The MD5 password hash algorithm is used for storing the
  245. old passwords.
  246. Instead of this option the <command>pam_pwhistory</command>
  247. module should be used.
  248. </para>
  249. </listitem>
  250. </varlistentry>
  251. <varlistentry>
  252. <term>
  253. <option>shadow</option>
  254. </term>
  255. <listitem>
  256. <para>
  257. Try to maintain a shadow based system.
  258. </para>
  259. </listitem>
  260. </varlistentry>
  261. <varlistentry>
  262. <term>
  263. <option>md5</option>
  264. </term>
  265. <listitem>
  266. <para>
  267. When a user changes their password next, encrypt
  268. it with the MD5 algorithm.
  269. </para>
  270. </listitem>
  271. </varlistentry>
  272. <varlistentry>
  273. <term>
  274. <option>bigcrypt</option>
  275. </term>
  276. <listitem>
  277. <para>
  278. When a user changes their password next,
  279. encrypt it with the DEC C2 algorithm.
  280. </para>
  281. </listitem>
  282. </varlistentry>
  283. <varlistentry>
  284. <term>
  285. <option>sha256</option>
  286. </term>
  287. <listitem>
  288. <para>
  289. When a user changes their password next,
  290. encrypt it with the SHA256 algorithm. The
  291. SHA256 algorithm must be supported by the <citerefentry>
  292. <refentrytitle>crypt</refentrytitle><manvolnum>3</manvolnum>
  293. </citerefentry> function.
  294. </para>
  295. </listitem>
  296. </varlistentry>
  297. <varlistentry>
  298. <term>
  299. <option>sha512</option>
  300. </term>
  301. <listitem>
  302. <para>
  303. When a user changes their password next,
  304. encrypt it with the SHA512 algorithm. The
  305. SHA512 algorithm must be supported by the <citerefentry>
  306. <refentrytitle>crypt</refentrytitle><manvolnum>3</manvolnum>
  307. </citerefentry> function.
  308. </para>
  309. </listitem>
  310. </varlistentry>
  311. <varlistentry>
  312. <term>
  313. <option>blowfish</option>
  314. </term>
  315. <listitem>
  316. <para>
  317. When a user changes their password next,
  318. encrypt it with the blowfish algorithm. The
  319. blowfish algorithm must be supported by the <citerefentry>
  320. <refentrytitle>crypt</refentrytitle><manvolnum>3</manvolnum>
  321. </citerefentry> function.
  322. </para>
  323. </listitem>
  324. </varlistentry>
  325. <varlistentry>
  326. <term>
  327. <option>gost_yescrypt</option>
  328. </term>
  329. <listitem>
  330. <para>
  331. When a user changes their password next,
  332. encrypt it with the gost-yescrypt algorithm. The
  333. gost-yescrypt algorithm must be supported by the <citerefentry>
  334. <refentrytitle>crypt</refentrytitle><manvolnum>3</manvolnum>
  335. </citerefentry> function.
  336. </para>
  337. </listitem>
  338. </varlistentry>
  339. <varlistentry>
  340. <term>
  341. <option>yescrypt</option>
  342. </term>
  343. <listitem>
  344. <para>
  345. When a user changes their password next,
  346. encrypt it with the yescrypt algorithm. The
  347. yescrypt algorithm must be supported by the <citerefentry>
  348. <refentrytitle>crypt</refentrytitle><manvolnum>3</manvolnum>
  349. </citerefentry> function.
  350. </para>
  351. </listitem>
  352. </varlistentry>
  353. <varlistentry>
  354. <term>
  355. <option>rounds=<replaceable>n</replaceable></option>
  356. </term>
  357. <listitem>
  358. <para>
  359. Set the optional number of rounds of the SHA256, SHA512,
  360. blowfish, gost-yescrypt, and yescrypt password hashing
  361. algorithms to
  362. <replaceable>n</replaceable>.
  363. </para>
  364. </listitem>
  365. </varlistentry>
  366. <varlistentry>
  367. <term>
  368. <option>broken_shadow</option>
  369. </term>
  370. <listitem>
  371. <para>
  372. Ignore errors reading shadow information for
  373. users in the account management module.
  374. </para>
  375. </listitem>
  376. </varlistentry>
  377. <varlistentry>
  378. <term>
  379. <option>minlen=<replaceable>n</replaceable></option>
  380. </term>
  381. <listitem>
  382. <para>
  383. Set a minimum password length of <replaceable>n</replaceable>
  384. characters. The max. for DES crypt based passwords are 8
  385. characters.
  386. </para>
  387. </listitem>
  388. </varlistentry>
  389. <varlistentry>
  390. <term>
  391. <option>no_pass_expiry</option>
  392. </term>
  393. <listitem>
  394. <para>
  395. When set ignore password expiration as defined by the
  396. <emphasis>shadow</emphasis> entry of the user. The option has an
  397. effect only in case <emphasis>pam_unix</emphasis> was not used
  398. for the authentication or it returned authentication failure
  399. meaning that other authentication source or method succeeded.
  400. The example can be public key authentication in
  401. <emphasis>sshd</emphasis>. The module will return
  402. <emphasis remap='B'>PAM_SUCCESS</emphasis> instead of eventual
  403. <emphasis remap='B'>PAM_NEW_AUTHTOK_REQD</emphasis> or
  404. <emphasis remap='B'>PAM_AUTHTOK_EXPIRED</emphasis>.
  405. </para>
  406. </listitem>
  407. </varlistentry>
  408. </variablelist>
  409. <para>
  410. Invalid arguments are logged with <citerefentry>
  411. <refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum>
  412. </citerefentry>.
  413. </para>
  414. </refsect1>
  415. <refsect1 id="pam_unix-types">
  416. <title>MODULE TYPES PROVIDED</title>
  417. <para>
  418. All module types (<option>account</option>, <option>auth</option>,
  419. <option>password</option> and <option>session</option>) are provided.
  420. </para>
  421. </refsect1>
  422. <refsect1 id='pam_unix-return_values'>
  423. <title>RETURN VALUES</title>
  424. <variablelist>
  425. <varlistentry>
  426. <term>PAM_IGNORE</term>
  427. <listitem>
  428. <para>
  429. Ignore this module.
  430. </para>
  431. </listitem>
  432. </varlistentry>
  433. </variablelist>
  434. </refsect1>
  435. <refsect1 id='pam_unix-examples'>
  436. <title>EXAMPLES</title>
  437. <para>
  438. An example usage for <filename>/etc/pam.d/login</filename>
  439. would be:
  440. <programlisting>
  441. # Authenticate the user
  442. auth required pam_unix.so
  443. # Ensure users account and password are still active
  444. account required pam_unix.so
  445. # Change the user's password, but at first check the strength
  446. # with pam_passwdqc(8)
  447. password required pam_passwdqc.so config=/etc/passwdqc.conf
  448. password required pam_unix.so use_authtok nullok yescrypt
  449. session required pam_unix.so
  450. </programlisting>
  451. </para>
  452. </refsect1>
  453. <refsect1 id='pam_unix-see_also'>
  454. <title>SEE ALSO</title>
  455. <para>
  456. <citerefentry>
  457. <refentrytitle>login.defs</refentrytitle><manvolnum>5</manvolnum>
  458. </citerefentry>,
  459. <citerefentry>
  460. <refentrytitle>pam.conf</refentrytitle><manvolnum>5</manvolnum>
  461. </citerefentry>,
  462. <citerefentry>
  463. <refentrytitle>pam.d</refentrytitle><manvolnum>5</manvolnum>
  464. </citerefentry>,
  465. <citerefentry>
  466. <refentrytitle>pam</refentrytitle><manvolnum>8</manvolnum>
  467. </citerefentry>
  468. </para>
  469. </refsect1>
  470. <refsect1 id='pam_unix-author'>
  471. <title>AUTHOR</title>
  472. <para>
  473. pam_unix was written by various people.
  474. </para>
  475. </refsect1>
  476. </refentry>