xref: /freebsd/lib/libpam/modules/pam_unix/pam_unix.8 (revision 02e9120893770924227138ba49df1edb3896112a)
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.Dd April 3, 2020
36.Dt PAM_UNIX 8
37.Os
38.Sh NAME
39.Nm pam_unix
40.Nd UNIX PAM module
41.Sh SYNOPSIS
42.Op Ar service-name
43.Ar module-type
44.Ar control-flag
45.Pa pam_unix
46.Op Ar options
47.Sh DESCRIPTION
48The
49.Ux
50authentication service module for PAM,
51.Nm
52provides functionality for three PAM categories:
53authentication, account management, and password management.
54In terms of the
55.Ar module-type
56parameter, they are the
57.Dq Li auth ,
58.Dq Li account ,
59and
60.Dq Li password
61features.
62It also provides a null function for session management.
63.Ss Ux Ss Authentication Module
64The
65.Ux
66authentication component provides functions to verify the identity of
67a user
68.Pq Fn pam_sm_authenticate ,
69which obtains the relevant
70.Xr passwd 5
71entry.
72It prompts the user for a password and verifies that this is correct with
73.Xr crypt 3 .
74.Pp
75The following options may be passed to the authentication module:
76.Bl -tag -width ".Cm use_first_pass"
77.It Cm debug
78.Xr syslog 3
79debugging information at
80.Dv LOG_DEBUG
81level.
82.It Cm use_first_pass
83If the authentication module is not the first in the stack, and a
84previous module obtained the user's password, that password is used to
85authenticate the user.
86If this fails, the authentication module returns failure without
87prompting the user for a password.
88This option has no effect if the authentication module is the first in
89the stack, or if no previous modules obtained the user's password.
90.It Cm try_first_pass
91This option is similar to the
92.Cm use_first_pass
93option, except that if the previously obtained password fails, the
94user is prompted for another password.
95.It Cm auth_as_self
96This option will require the user to authenticate themselves as
97themselves, not as the account they are attempting to access.
98This is primarily for services like
99.Xr su 1 ,
100where the user's ability to retype their own password might be deemed
101sufficient.
102.It Cm nullok
103If the password database has no password for the entity being
104authenticated, then this option will forgo password prompting, and
105silently allow authentication to succeed.
106.Pp
107.Sy NOTE:
108If
109.Nm
110is invoked by a process that does not have the privileges required to
111access the password database (in most cases, this means root
112privileges), the
113.Cm nullok
114option may cause
115.Nm
116to allow any user to log in with any password.
117.It Cm emptyok
118If the password database contains the password for the entity being
119authenticated, but the password matches an empty string,
120then this option will forgo password prompting, and
121silently allow authentication to succeed.
122.Pp
123The difference between this and
124.Cm nullok
125is that it avoids prompting for password when the password is set
126to an empty string, as opposed to not being set.
127.It Cm local_pass
128Use only the local password database, even if NIS is in use.
129This will cause an authentication failure if the system is configured
130to only use NIS.
131.It Cm nis_pass
132Use only the NIS password database.
133This will cause an authentication failure if the system is not
134configured to use NIS.
135.El
136.Ss Ux Ss Account Management Module
137The
138.Ux
139account management component provides a function to perform account
140management,
141.Fn pam_sm_acct_mgmt .
142The function verifies that the authenticated user is allowed to log
143into the local user account by checking the following criteria:
144.Bl -dash -offset indent
145.It
146locked status of the account compatible with
147.Xr pw 8
148.Cm lock ;
149.It
150the password expiry date from
151.Xr passwd 5 ;
152.It
153.Xr login.conf 5
154restrictions on the remote host, login time, and tty.
155.El
156.Pp
157The following options may be passed to the management module:
158.Bl -tag -width ".Cm use_first_pass"
159.It Cm debug
160.Xr syslog 3
161debugging information at
162.Dv LOG_DEBUG
163level.
164.El
165.Ss Ux Ss Password Management Module
166The
167.Ux
168password management component provides a function to perform password
169management,
170.Fn pam_sm_chauthtok .
171The function changes
172the user's password.
173.Pp
174The following options may be passed to the password module:
175.Bl -tag -width ".Cm use_first_pass"
176.It Cm debug
177.Xr syslog 3
178debugging information at
179.Dv LOG_DEBUG
180level.
181.It Cm no_warn
182suppress warning messages to the user.
183These messages include reasons why the user's authentication attempt
184was declined.
185.It Cm local_pass
186forces the password module to change a local password in favour of a
187NIS one.
188.It Cm nis_pass
189forces the password module to change a NIS password in favour of a
190local one.
191.El
192.Sh FILES
193.Bl -tag -width ".Pa /etc/master.passwd" -compact
194.It Pa /etc/master.passwd
195default
196.Ux
197password database.
198.El
199.Sh SEE ALSO
200.Xr passwd 1 ,
201.Xr getlogin 2 ,
202.Xr crypt 3 ,
203.Xr getpwent 3 ,
204.Xr syslog 3 ,
205.Xr nsswitch.conf 5 ,
206.Xr passwd 5 ,
207.Xr pam 3 ,
208.Xr pw 8 ,
209.Xr yp 8
210.Sh BUGS
211The
212.Nm
213module ignores the
214.Dv PAM_CHANGE_EXPIRED_AUTHTOK
215flag.
216