1.\" Copyright (c) 2001 Mark R V Murray 2.\" All rights reserved. 3.\" Copyright (c) 2001 Networks Associates Technology, Inc. 4.\" All rights reserved. 5.\" 6.\" This software was developed for the FreeBSD Project by ThinkSec AS and 7.\" NAI Labs, the Security Research Division of Network Associates, Inc. 8.\" under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the 9.\" DARPA CHATS research program. 10.\" 11.\" Redistribution and use in source and binary forms, with or without 12.\" modification, are permitted provided that the following conditions 13.\" are met: 14.\" 1. Redistributions of source code must retain the above copyright 15.\" notice, this list of conditions and the following disclaimer. 16.\" 2. Redistributions in binary form must reproduce the above copyright 17.\" notice, this list of conditions and the following disclaimer in the 18.\" documentation and/or other materials provided with the distribution. 19.\" 3. The name of the author may not be used to endorse or promote 20.\" products derived from this software without specific prior written 21.\" permission. 22.\" 23.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 24.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 27.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33.\" SUCH DAMAGE. 34.\" 35.\" $FreeBSD$ 36.\" 37.Dd April 3, 2020 38.Dt PAM_UNIX 8 39.Os 40.Sh NAME 41.Nm pam_unix 42.Nd UNIX PAM module 43.Sh SYNOPSIS 44.Op Ar service-name 45.Ar module-type 46.Ar control-flag 47.Pa pam_unix 48.Op Ar options 49.Sh DESCRIPTION 50The 51.Ux 52authentication service module for PAM, 53.Nm 54provides functionality for three PAM categories: 55authentication, account management, and password management. 56In terms of the 57.Ar module-type 58parameter, they are the 59.Dq Li auth , 60.Dq Li account , 61and 62.Dq Li password 63features. 64It also provides a null function for session management. 65.Ss Ux Ss Authentication Module 66The 67.Ux 68authentication component provides functions to verify the identity of 69a user 70.Pq Fn pam_sm_authenticate , 71which obtains the relevant 72.Xr passwd 5 73entry. 74It prompts the user for a password and verifies that this is correct with 75.Xr crypt 3 . 76.Pp 77The following options may be passed to the authentication module: 78.Bl -tag -width ".Cm use_first_pass" 79.It Cm debug 80.Xr syslog 3 81debugging information at 82.Dv LOG_DEBUG 83level. 84.It Cm use_first_pass 85If the authentication module is not the first in the stack, and a 86previous module obtained the user's password, that password is used to 87authenticate the user. 88If this fails, the authentication module returns failure without 89prompting the user for a password. 90This option has no effect if the authentication module is the first in 91the stack, or if no previous modules obtained the user's password. 92.It Cm try_first_pass 93This option is similar to the 94.Cm use_first_pass 95option, except that if the previously obtained password fails, the 96user is prompted for another password. 97.It Cm auth_as_self 98This option will require the user to authenticate themselves as 99themselves, not as the account they are attempting to access. 100This is primarily for services like 101.Xr su 1 , 102where the user's ability to retype their own password might be deemed 103sufficient. 104.It Cm nullok 105If the password database has no password for the entity being 106authenticated, then this option will forgo password prompting, and 107silently allow authentication to succeed. 108.Pp 109.Sy NOTE: 110If 111.Nm 112is invoked by a process that does not have the privileges required to 113access the password database (in most cases, this means root 114privileges), the 115.Cm nullok 116option may cause 117.Nm 118to allow any user to log in with any password. 119.It Cm emptyok 120If the password database contains the password for the entity being 121authenticated, but the password matches an empty string, 122then this option will forgo password prompting, and 123silently allow authentication to succeed. 124.Pp 125The difference between this and 126.Cm nullok 127is that it avoids prompting for password when the password is set 128to an empty string, as opposed to not being set. 129.It Cm local_pass 130Use only the local password database, even if NIS is in use. 131This will cause an authentication failure if the system is configured 132to only use NIS. 133.It Cm nis_pass 134Use only the NIS password database. 135This will cause an authentication failure if the system is not 136configured to use NIS. 137.El 138.Ss Ux Ss Account Management Module 139The 140.Ux 141account management component provides a function to perform account 142management, 143.Fn pam_sm_acct_mgmt . 144The function verifies that the authenticated user is allowed to log 145into the local user account by checking the following criteria: 146.Bl -dash -offset indent 147.It 148locked status of the account compatible with 149.Xr pw 8 150.Cm lock ; 151.It 152the password expiry date from 153.Xr passwd 5 ; 154.It 155.Xr login.conf 5 156restrictions on the remote host, login time, and tty. 157.El 158.Pp 159The following options may be passed to the management module: 160.Bl -tag -width ".Cm use_first_pass" 161.It Cm debug 162.Xr syslog 3 163debugging information at 164.Dv LOG_DEBUG 165level. 166.El 167.Ss Ux Ss Password Management Module 168The 169.Ux 170password management component provides a function to perform password 171management, 172.Fn pam_sm_chauthtok . 173The function changes 174the user's password. 175.Pp 176The following options may be passed to the password module: 177.Bl -tag -width ".Cm use_first_pass" 178.It Cm debug 179.Xr syslog 3 180debugging information at 181.Dv LOG_DEBUG 182level. 183.It Cm no_warn 184suppress warning messages to the user. 185These messages include reasons why the user's authentication attempt 186was declined. 187.It Cm local_pass 188forces the password module to change a local password in favour of a 189NIS one. 190.It Cm nis_pass 191forces the password module to change a NIS password in favour of a 192local one. 193.El 194.Sh FILES 195.Bl -tag -width ".Pa /etc/master.passwd" -compact 196.It Pa /etc/master.passwd 197default 198.Ux 199password database. 200.El 201.Sh SEE ALSO 202.Xr passwd 1 , 203.Xr getlogin 2 , 204.Xr crypt 3 , 205.Xr getpwent 3 , 206.Xr syslog 3 , 207.Xr nsswitch.conf 5 , 208.Xr passwd 5 , 209.Xr pam 8 , 210.Xr pw 8 , 211.Xr yp 8 212.Sh BUGS 213The 214.Nm 215module ignores the 216.Dv PAM_CHANGE_EXPIRED_AUTHTOK 217flag. 218