xref: /freebsd/lib/libpam/modules/pam_unix/pam_unix.8 (revision 6e1fc0118033f42b7c0d3623c8f67a89ebecabb2)
11642eb1aSMark Murray.\" Copyright (c) 2001 Mark R V Murray
21642eb1aSMark Murray.\" All rights reserved.
3f03a4b81SDag-Erling Smørgrav.\" Copyright (c) 2001 Networks Associates Technology, Inc.
4d65e5dfaSDag-Erling Smørgrav.\" All rights reserved.
5d65e5dfaSDag-Erling Smørgrav.\"
6d65e5dfaSDag-Erling Smørgrav.\" This software was developed for the FreeBSD Project by ThinkSec AS and
7d65e5dfaSDag-Erling Smørgrav.\" NAI Labs, the Security Research Division of Network Associates, Inc.
8d65e5dfaSDag-Erling Smørgrav.\" under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
9d65e5dfaSDag-Erling Smørgrav.\" DARPA CHATS research program.
101642eb1aSMark Murray.\"
111642eb1aSMark Murray.\" Redistribution and use in source and binary forms, with or without
121642eb1aSMark Murray.\" modification, are permitted provided that the following conditions
131642eb1aSMark Murray.\" are met:
141642eb1aSMark Murray.\" 1. Redistributions of source code must retain the above copyright
151642eb1aSMark Murray.\"    notice, this list of conditions and the following disclaimer.
161642eb1aSMark Murray.\" 2. Redistributions in binary form must reproduce the above copyright
171642eb1aSMark Murray.\"    notice, this list of conditions and the following disclaimer in the
181642eb1aSMark Murray.\"    documentation and/or other materials provided with the distribution.
19d65e5dfaSDag-Erling Smørgrav.\" 3. The name of the author may not be used to endorse or promote
20d65e5dfaSDag-Erling Smørgrav.\"    products derived from this software without specific prior written
21d65e5dfaSDag-Erling Smørgrav.\"    permission.
221642eb1aSMark Murray.\"
231642eb1aSMark Murray.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
241642eb1aSMark Murray.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
251642eb1aSMark Murray.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
261642eb1aSMark Murray.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
271642eb1aSMark Murray.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
281642eb1aSMark Murray.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
291642eb1aSMark Murray.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
301642eb1aSMark Murray.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
311642eb1aSMark Murray.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
321642eb1aSMark Murray.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
331642eb1aSMark Murray.\" SUCH DAMAGE.
341642eb1aSMark Murray.\"
35bfd8b9b8SEdward Tomasz Napierala.Dd April 3, 2020
361642eb1aSMark Murray.Dt PAM_UNIX 8
371642eb1aSMark Murray.Os
381642eb1aSMark Murray.Sh NAME
391642eb1aSMark Murray.Nm pam_unix
401642eb1aSMark Murray.Nd UNIX PAM module
411642eb1aSMark Murray.Sh SYNOPSIS
421642eb1aSMark Murray.Op Ar service-name
431642eb1aSMark Murray.Ar module-type
441642eb1aSMark Murray.Ar control-flag
451642eb1aSMark Murray.Pa pam_unix
461642eb1aSMark Murray.Op Ar options
471642eb1aSMark Murray.Sh DESCRIPTION
481642eb1aSMark MurrayThe
491642eb1aSMark Murray.Ux
501642eb1aSMark Murrayauthentication service module for PAM,
511642eb1aSMark Murray.Nm
525429f490SRuslan Ermilovprovides functionality for three PAM categories:
5384e3202fSDag-Erling Smørgravauthentication, account management, and password management.
541642eb1aSMark MurrayIn terms of the
551642eb1aSMark Murray.Ar module-type
561642eb1aSMark Murrayparameter, they are the
575429f490SRuslan Ermilov.Dq Li auth ,
585429f490SRuslan Ermilov.Dq Li account ,
591642eb1aSMark Murrayand
605429f490SRuslan Ermilov.Dq Li password
611642eb1aSMark Murrayfeatures.
621642eb1aSMark MurrayIt also provides a null function for session management.
6308ecaa10SRuslan Ermilov.Ss Ux Ss Authentication Module
641642eb1aSMark MurrayThe
651642eb1aSMark Murray.Ux
6684e3202fSDag-Erling Smørgravauthentication component provides functions to verify the identity of
6784e3202fSDag-Erling Smørgrava user
681642eb1aSMark Murray.Pq Fn pam_sm_authenticate ,
691642eb1aSMark Murraywhich obtains the relevant
701642eb1aSMark Murray.Xr passwd 5
711642eb1aSMark Murrayentry.
7284e3202fSDag-Erling SmørgravIt prompts the user for a password and verifies that this is correct with
731642eb1aSMark Murray.Xr crypt 3 .
741642eb1aSMark Murray.Pp
751642eb1aSMark MurrayThe following options may be passed to the authentication module:
76e8b02a42SRuslan Ermilov.Bl -tag -width ".Cm use_first_pass"
771642eb1aSMark Murray.It Cm debug
781642eb1aSMark Murray.Xr syslog 3
791642eb1aSMark Murraydebugging information at
801642eb1aSMark Murray.Dv LOG_DEBUG
811642eb1aSMark Murraylevel.
821642eb1aSMark Murray.It Cm use_first_pass
8384e3202fSDag-Erling SmørgravIf the authentication module is not the first in the stack, and a
8484e3202fSDag-Erling Smørgravprevious module obtained the user's password, that password is used to
8584e3202fSDag-Erling Smørgravauthenticate the user.
8684e3202fSDag-Erling SmørgravIf this fails, the authentication module returns failure without
8784e3202fSDag-Erling Smørgravprompting the user for a password.
8884e3202fSDag-Erling SmørgravThis option has no effect if the authentication module is the first in
8984e3202fSDag-Erling Smørgravthe stack, or if no previous modules obtained the user's password.
901642eb1aSMark Murray.It Cm try_first_pass
911642eb1aSMark MurrayThis option is similar to the
921642eb1aSMark Murray.Cm use_first_pass
9384e3202fSDag-Erling Smørgravoption, except that if the previously obtained password fails, the
9484e3202fSDag-Erling Smørgravuser is prompted for another password.
951642eb1aSMark Murray.It Cm auth_as_self
9684e3202fSDag-Erling SmørgravThis option will require the user to authenticate themselves as
9784e3202fSDag-Erling Smørgravthemselves, not as the account they are attempting to access.
981642eb1aSMark MurrayThis is primarily for services like
991642eb1aSMark Murray.Xr su 1 ,
10084e3202fSDag-Erling Smørgravwhere the user's ability to retype their own password might be deemed
10184e3202fSDag-Erling Smørgravsufficient.
1021642eb1aSMark Murray.It Cm nullok
10384e3202fSDag-Erling SmørgravIf the password database has no password for the entity being
10484e3202fSDag-Erling Smørgravauthenticated, then this option will forgo password prompting, and
10584e3202fSDag-Erling Smørgravsilently allow authentication to succeed.
10613e1b162SDag-Erling Smørgrav.Pp
10713e1b162SDag-Erling Smørgrav.Sy NOTE:
10813e1b162SDag-Erling SmørgravIf
10913e1b162SDag-Erling Smørgrav.Nm
11013e1b162SDag-Erling Smørgravis invoked by a process that does not have the privileges required to
11113e1b162SDag-Erling Smørgravaccess the password database (in most cases, this means root
11213e1b162SDag-Erling Smørgravprivileges), the
11313e1b162SDag-Erling Smørgrav.Cm nullok
11413e1b162SDag-Erling Smørgravoption may cause
11513e1b162SDag-Erling Smørgrav.Nm
11613e1b162SDag-Erling Smørgravto allow any user to log in with any password.
117bfd8b9b8SEdward Tomasz Napierala.It Cm emptyok
118bfd8b9b8SEdward Tomasz NapieralaIf the password database contains the password for the entity being
119bfd8b9b8SEdward Tomasz Napieralaauthenticated, but the password matches an empty string,
120bfd8b9b8SEdward Tomasz Napieralathen this option will forgo password prompting, and
121bfd8b9b8SEdward Tomasz Napieralasilently allow authentication to succeed.
122bfd8b9b8SEdward Tomasz Napierala.Pp
123bfd8b9b8SEdward Tomasz NapieralaThe difference between this and
124bfd8b9b8SEdward Tomasz Napierala.Cm nullok
125bfd8b9b8SEdward Tomasz Napieralais that it avoids prompting for password when the password is set
126bfd8b9b8SEdward Tomasz Napieralato an empty string, as opposed to not being set.
127d65e5dfaSDag-Erling Smørgrav.It Cm local_pass
12884e3202fSDag-Erling SmørgravUse only the local password database, even if NIS is in use.
12984e3202fSDag-Erling SmørgravThis will cause an authentication failure if the system is configured
130d65e5dfaSDag-Erling Smørgravto only use NIS.
131d65e5dfaSDag-Erling Smørgrav.It Cm nis_pass
132d65e5dfaSDag-Erling SmørgravUse only the NIS password database.
13384e3202fSDag-Erling SmørgravThis will cause an authentication failure if the system is not
13484e3202fSDag-Erling Smørgravconfigured to use NIS.
1351642eb1aSMark Murray.El
13608ecaa10SRuslan Ermilov.Ss Ux Ss Account Management Module
1371642eb1aSMark MurrayThe
1381642eb1aSMark Murray.Ux
13984e3202fSDag-Erling Smørgravaccount management component provides a function to perform account
14084e3202fSDag-Erling Smørgravmanagement,
1411642eb1aSMark Murray.Fn pam_sm_acct_mgmt .
14284e3202fSDag-Erling SmørgravThe function verifies that the authenticated user is allowed to log
14384e3202fSDag-Erling Smørgravinto the local user account by checking the following criteria:
144cf21ead5SYaroslav Tykhiy.Bl -dash -offset indent
145cf21ead5SYaroslav Tykhiy.It
146cf21ead5SYaroslav Tykhiylocked status of the account compatible with
147cf21ead5SYaroslav Tykhiy.Xr pw 8
148cf21ead5SYaroslav Tykhiy.Cm lock ;
149cf21ead5SYaroslav Tykhiy.It
150cf21ead5SYaroslav Tykhiythe password expiry date from
151cf21ead5SYaroslav Tykhiy.Xr passwd 5 ;
152cf21ead5SYaroslav Tykhiy.It
153cf21ead5SYaroslav Tykhiy.Xr login.conf 5
154cf21ead5SYaroslav Tykhiyrestrictions on the remote host, login time, and tty.
155cf21ead5SYaroslav Tykhiy.El
1561642eb1aSMark Murray.Pp
1571642eb1aSMark MurrayThe following options may be passed to the management module:
158e8b02a42SRuslan Ermilov.Bl -tag -width ".Cm use_first_pass"
1591642eb1aSMark Murray.It Cm debug
1601642eb1aSMark Murray.Xr syslog 3
1611642eb1aSMark Murraydebugging information at
1621642eb1aSMark Murray.Dv LOG_DEBUG
1631642eb1aSMark Murraylevel.
1641642eb1aSMark Murray.El
1653d55a6c0SMark Murray.Ss Ux Ss Password Management Module
1663d55a6c0SMark MurrayThe
1673d55a6c0SMark Murray.Ux
16884e3202fSDag-Erling Smørgravpassword management component provides a function to perform password
16984e3202fSDag-Erling Smørgravmanagement,
1703d55a6c0SMark Murray.Fn pam_sm_chauthtok .
1713d55a6c0SMark MurrayThe function changes
1723d55a6c0SMark Murraythe user's password.
1733d55a6c0SMark Murray.Pp
1743d55a6c0SMark MurrayThe following options may be passed to the password module:
1753d55a6c0SMark Murray.Bl -tag -width ".Cm use_first_pass"
1763d55a6c0SMark Murray.It Cm debug
1773d55a6c0SMark Murray.Xr syslog 3
1783d55a6c0SMark Murraydebugging information at
1793d55a6c0SMark Murray.Dv LOG_DEBUG
1803d55a6c0SMark Murraylevel.
1813d55a6c0SMark Murray.It Cm no_warn
1823d55a6c0SMark Murraysuppress warning messages to the user.
18384e3202fSDag-Erling SmørgravThese messages include reasons why the user's authentication attempt
18484e3202fSDag-Erling Smørgravwas declined.
1853d55a6c0SMark Murray.It Cm local_pass
18684e3202fSDag-Erling Smørgravforces the password module to change a local password in favour of a
18784e3202fSDag-Erling SmørgravNIS one.
1883d55a6c0SMark Murray.It Cm nis_pass
18984e3202fSDag-Erling Smørgravforces the password module to change a NIS password in favour of a
19084e3202fSDag-Erling Smørgravlocal one.
1913d55a6c0SMark Murray.El
1921642eb1aSMark Murray.Sh FILES
193e8b02a42SRuslan Ermilov.Bl -tag -width ".Pa /etc/master.passwd" -compact
1941642eb1aSMark Murray.It Pa /etc/master.passwd
1951642eb1aSMark Murraydefault
1961642eb1aSMark Murray.Ux
1971642eb1aSMark Murraypassword database.
1981642eb1aSMark Murray.El
1991642eb1aSMark Murray.Sh SEE ALSO
200d65e5dfaSDag-Erling Smørgrav.Xr passwd 1 ,
201945b9f4dSRuslan Ermilov.Xr getlogin 2 ,
202945b9f4dSRuslan Ermilov.Xr crypt 3 ,
203945b9f4dSRuslan Ermilov.Xr getpwent 3 ,
204*6e1fc011SGraham Percival.Xr pam 3 ,
205d65e5dfaSDag-Erling Smørgrav.Xr syslog 3 ,
206945b9f4dSRuslan Ermilov.Xr nsswitch.conf 5 ,
207945b9f4dSRuslan Ermilov.Xr passwd 5 ,
208cf21ead5SYaroslav Tykhiy.Xr pw 8 ,
2093ac17febSRuslan Ermilov.Xr yp 8
21023b8f4d8SDag-Erling Smørgrav.Sh BUGS
21123b8f4d8SDag-Erling SmørgravThe
21223b8f4d8SDag-Erling Smørgrav.Nm
21323b8f4d8SDag-Erling Smørgravmodule ignores the
21423b8f4d8SDag-Erling Smørgrav.Dv PAM_CHANGE_EXPIRED_AUTHTOK
21523b8f4d8SDag-Erling Smørgravflag.
216