Import Linux-PAM.
[profile/ivi/pam.git] / doc / man / pam.3
1 .\"     Title: pam
2 .\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
3 .\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
4 .\"      Date: 06/21/2011
5 .\"    Manual: Linux-PAM Manual
6 .\"    Source: Linux-PAM Manual
7 .\"  Language: English
8 .\"
9 .TH "PAM" "3" "06/21/2011" "Linux-PAM Manual" "Linux-PAM Manual"
10 .\" -----------------------------------------------------------------
11 .\" * (re)Define some macros
12 .\" -----------------------------------------------------------------
13 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14 .\" toupper - uppercase a string (locale-aware)
15 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16 .de toupper
17 .tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
18 \\$*
19 .tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
20 ..
21 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 .\" SH-xref - format a cross-reference to an SH section
23 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24 .de SH-xref
25 .ie n \{\
26 .\}
27 .toupper \\$*
28 .el \{\
29 \\$*
30 .\}
31 ..
32 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33 .\" SH - level-one heading that works better for non-TTY output
34 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35 .de1 SH
36 .\" put an extra blank line of space above the head in non-TTY output
37 .if t \{\
38 .sp 1
39 .\}
40 .sp \\n[PD]u
41 .nr an-level 1
42 .set-an-margin
43 .nr an-prevailing-indent \\n[IN]
44 .fi
45 .in \\n[an-margin]u
46 .ti 0
47 .HTML-TAG ".NH \\n[an-level]"
48 .it 1 an-trap
49 .nr an-no-space-flag 1
50 .nr an-break-flag 1
51 \." make the size of the head bigger
52 .ps +3
53 .ft B
54 .ne (2v + 1u)
55 .ie n \{\
56 .\" if n (TTY output), use uppercase
57 .toupper \\$*
58 .\}
59 .el \{\
60 .nr an-break-flag 0
61 .\" if not n (not TTY), use normal case (not uppercase)
62 \\$1
63 .in \\n[an-margin]u
64 .ti 0
65 .\" if not n (not TTY), put a border/line under subheading
66 .sp -.6
67 \l'\n(.lu'
68 .\}
69 ..
70 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
71 .\" SS - level-two heading that works better for non-TTY output
72 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73 .de1 SS
74 .sp \\n[PD]u
75 .nr an-level 1
76 .set-an-margin
77 .nr an-prevailing-indent \\n[IN]
78 .fi
79 .in \\n[IN]u
80 .ti \\n[SN]u
81 .it 1 an-trap
82 .nr an-no-space-flag 1
83 .nr an-break-flag 1
84 .ps \\n[PS-SS]u
85 \." make the size of the head bigger
86 .ps +2
87 .ft B
88 .ne (2v + 1u)
89 .if \\n[.$] \&\\$*
90 ..
91 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
92 .\" BB/BE - put background/screen (filled box) around block of text
93 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
94 .de BB
95 .if t \{\
96 .sp -.5
97 .br
98 .in +2n
99 .ll -2n
100 .gcolor red
101 .di BX
102 .\}
103 ..
104 .de EB
105 .if t \{\
106 .if "\\$2"adjust-for-leading-newline" \{\
107 .sp -1
108 .\}
109 .br
110 .di
111 .in
112 .ll
113 .gcolor
114 .nr BW \\n(.lu-\\n(.i
115 .nr BH \\n(dn+.5v
116 .ne \\n(BHu+.5v
117 .ie "\\$2"adjust-for-leading-newline" \{\
118 \M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
119 .\}
120 .el \{\
121 \M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
122 .\}
123 .in 0
124 .sp -.5v
125 .nf
126 .BX
127 .in
128 .sp .5v
129 .fi
130 .\}
131 ..
132 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
133 .\" BM/EM - put colored marker in margin next to block of text
134 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
135 .de BM
136 .if t \{\
137 .br
138 .ll -2n
139 .gcolor red
140 .di BX
141 .\}
142 ..
143 .de EM
144 .if t \{\
145 .br
146 .di
147 .ll
148 .gcolor
149 .nr BH \\n(dn
150 .ne \\n(BHu
151 \M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
152 .in 0
153 .nf
154 .BX
155 .in
156 .fi
157 .\}
158 ..
159 .\" -----------------------------------------------------------------
160 .\" * set default formatting
161 .\" -----------------------------------------------------------------
162 .\" disable hyphenation
163 .nh
164 .\" disable justification (adjust text to left margin only)
165 .ad l
166 .\" -----------------------------------------------------------------
167 .\" * MAIN CONTENT STARTS HERE *
168 .\" -----------------------------------------------------------------
169 .SH "Name"
170 pam \- Pluggable Authentication Modules Library
171 .SH "Synopsis"
172 .sp
173 .ft B
174 .fam C
175 .ps -1
176 .nf
177 #include <security/pam_appl\&.h>
178 .fi
179 .fam
180 .ps +1
181 .ft
182 .sp
183 .ft B
184 .fam C
185 .ps -1
186 .nf
187 #include <security/pam_modules\&.h>
188 .fi
189 .fam
190 .ps +1
191 .ft
192 .sp
193 .ft B
194 .fam C
195 .ps -1
196 .nf
197 #include <security/pam_ext\&.h>
198 .fi
199 .fam
200 .ps +1
201 .ft
202 .SH "DESCRIPTION"
203 .PP
204
205 \fBPAM\fR
206 is a system of libraries that handle the authentication tasks of applications (services) on the system\&. The library provides a stable general interface (Application Programming Interface \- API) that privilege granting programs (such as
207 \fBlogin\fR(1)
208 and
209 \fBsu\fR(1)) defer to to perform standard authentication tasks\&.
210 .SS "Initialization and Cleanup"
211 .PP
212 The
213 \fBpam_start\fR(3)
214 function creates the PAM context and initiates the PAM transaction\&. It is the first of the PAM functions that needs to be called by an application\&. The transaction state is contained entirely within the structure identified by this handle, so it is possible to have multiple transactions in parallel\&. But it is not possible to use the same handle for different transactions, a new one is needed for every new context\&.
215 .PP
216 The
217 \fBpam_end\fR(3)
218 function terminates the PAM transaction and is the last function an application should call in the PAM context\&. Upon return the handle pamh is no longer valid and all memory associated with it will be invalid\&. It can be called at any time to terminate a PAM transaction\&.
219 .SS "Authentication"
220 .PP
221 The
222 \fBpam_authenticate\fR(3)
223 function is used to authenticate the user\&. The user is required to provide an authentication token depending upon the authentication service, usually this is a password, but could also be a finger print\&.
224 .PP
225 The
226 \fBpam_setcred\fR(3)
227 function manages the userscredentials\&.
228 .SS "Account Management"
229 .PP
230 The
231 \fBpam_acct_mgmt\fR(3)
232 function is used to determine if the users account is valid\&. It checks for authentication token and account expiration and verifies access restrictions\&. It is typically called after the user has been authenticated\&.
233 .SS "Password Management"
234 .PP
235 The
236 \fBpam_chauthtok\fR(3)
237 function is used to change the authentication token for a given user on request or because the token has expired\&.
238 .SS "Session Management"
239 .PP
240 The
241 \fBpam_open_session\fR(3)
242 function sets up a user session for a previously successful authenticated user\&. The session should later be terminated with a call to
243 \fBpam_close_session\fR(3)\&.
244 .SS "Conversation"
245 .PP
246 The PAM library uses an application\-defined callback to allow a direct communication between a loaded module and the application\&. This callback is specified by the
247 \fIstruct pam_conv\fR
248 passed to
249 \fBpam_start\fR(3)
250 at the start of the transaction\&. See
251 \fBpam_conv\fR(3)
252 for details\&.
253 .SS "Data Objects"
254 .PP
255 The
256 \fBpam_set_item\fR(3)
257 and
258 \fBpam_get_item\fR(3)
259 functions allows applications and PAM service modules to set and retrieve PAM informations\&.
260 .PP
261 The
262 \fBpam_get_user\fR(3)
263 function is the preferred method to obtain the username\&.
264 .PP
265 The
266 \fBpam_set_data\fR(3)
267 and
268 \fBpam_get_data\fR(3)
269 functions allows PAM service modules to set and retrieve free\-form data from one invocation to another\&.
270 .SS "Environment and Error Management"
271 .PP
272 The
273 \fBpam_putenv\fR(3),
274 \fBpam_getenv\fR(3)
275 and
276 \fBpam_getenvlist\fR(3)
277 functions are for maintaining a set of private environment variables\&.
278 .PP
279 The
280 \fBpam_strerror\fR(3)
281 function returns a pointer to a string describing the given PAM error code\&.
282 .SH "RETURN VALUES"
283 .PP
284 The following return codes are known by PAM:
285 .PP
286 PAM_ABORT
287 .RS 4
288 Critical error, immediate abort\&.
289 .RE
290 .PP
291 PAM_ACCT_EXPIRED
292 .RS 4
293 User account has expired\&.
294 .RE
295 .PP
296 PAM_AUTHINFO_UNAVAIL
297 .RS 4
298 Authentication service cannot retrieve authentication info\&.
299 .RE
300 .PP
301 PAM_AUTHTOK_DISABLE_AGING
302 .RS 4
303 Authentication token aging disabled\&.
304 .RE
305 .PP
306 PAM_AUTHTOK_ERR
307 .RS 4
308 Authentication token manipulation error\&.
309 .RE
310 .PP
311 PAM_AUTHTOK_EXPIRED
312 .RS 4
313 Authentication token expired\&.
314 .RE
315 .PP
316 PAM_AUTHTOK_LOCK_BUSY
317 .RS 4
318 Authentication token lock busy\&.
319 .RE
320 .PP
321 PAM_AUTHTOK_RECOVERY_ERR
322 .RS 4
323 Authentication information cannot be recovered\&.
324 .RE
325 .PP
326 PAM_AUTH_ERR
327 .RS 4
328 Authentication failure\&.
329 .RE
330 .PP
331 PAM_BUF_ERR
332 .RS 4
333 Memory buffer error\&.
334 .RE
335 .PP
336 PAM_CONV_ERR
337 .RS 4
338 Conversation failure\&.
339 .RE
340 .PP
341 PAM_CRED_ERR
342 .RS 4
343 Failure setting user credentials\&.
344 .RE
345 .PP
346 PAM_CRED_EXPIRED
347 .RS 4
348 User credentials expired\&.
349 .RE
350 .PP
351 PAM_CRED_INSUFFICIENT
352 .RS 4
353 Insufficient credentials to access authentication data\&.
354 .RE
355 .PP
356 PAM_CRED_UNAVAIL
357 .RS 4
358 Authentication service cannot retrieve user credentials\&.
359 .RE
360 .PP
361 PAM_IGNORE
362 .RS 4
363 The return value should be ignored by PAM dispatch\&.
364 .RE
365 .PP
366 PAM_MAXTRIES
367 .RS 4
368 Have exhausted maximum number of retries for service\&.
369 .RE
370 .PP
371 PAM_MODULE_UNKNOWN
372 .RS 4
373 Module is unknown\&.
374 .RE
375 .PP
376 PAM_NEW_AUTHTOK_REQD
377 .RS 4
378 Authentication token is no longer valid; new one required\&.
379 .RE
380 .PP
381 PAM_NO_MODULE_DATA
382 .RS 4
383 No module specific data is present\&.
384 .RE
385 .PP
386 PAM_OPEN_ERR
387 .RS 4
388 Failed to load module\&.
389 .RE
390 .PP
391 PAM_PERM_DENIED
392 .RS 4
393 Permission denied\&.
394 .RE
395 .PP
396 PAM_SERVICE_ERR
397 .RS 4
398 Error in service module\&.
399 .RE
400 .PP
401 PAM_SESSION_ERR
402 .RS 4
403 Cannot make/remove an entry for the specified session\&.
404 .RE
405 .PP
406 PAM_SUCCESS
407 .RS 4
408 Success\&.
409 .RE
410 .PP
411 PAM_SYMBOL_ERR
412 .RS 4
413 Symbol not found\&.
414 .RE
415 .PP
416 PAM_SYSTEM_ERR
417 .RS 4
418 System error\&.
419 .RE
420 .PP
421 PAM_TRY_AGAIN
422 .RS 4
423 Failed preliminary check by password service\&.
424 .RE
425 .PP
426 PAM_USER_UNKNOWN
427 .RS 4
428 User not known to the underlying authentication module\&.
429 .RE
430 .SH "SEE ALSO"
431 .PP
432
433 \fBpam_acct_mgmt\fR(3),
434 \fBpam_authenticate\fR(3),
435 \fBpam_chauthtok\fR(3),
436 \fBpam_close_session\fR(3),
437 \fBpam_conv\fR(3),
438 \fBpam_end\fR(3),
439 \fBpam_get_data\fR(3),
440 \fBpam_getenv\fR(3),
441 \fBpam_getenvlist\fR(3),
442 \fBpam_get_item\fR(3),
443 \fBpam_get_user\fR(3),
444 \fBpam_open_session\fR(3),
445 \fBpam_putenv\fR(3),
446 \fBpam_set_data\fR(3),
447 \fBpam_set_item\fR(3),
448 \fBpam_setcred\fR(3),
449 \fBpam_start\fR(3),
450 \fBpam_strerror\fR(3)
451 .SH "NOTES"
452 .PP
453 The
454 \fIlibpam\fR
455 interfaces are only thread\-safe if each thread within the multithreaded application uses its own PAM handle\&.