PAM_GET_ITEM(3)
π PAM_GET_ITEM π
okay bestie, welcome to pam_get_item β the <hotpink>slay little getterthat lives in theLinux-PAM manual, section 3. this is <purple>pam_get_item` 3 and it's literally how you peek at PAM info. no cap. β¨
πΈ SYNOPSIS πΈ
like, this is the whole vibe:
#include <security/pam_modules.h>
int pam_get_item(const pam_handle_t *pamh, int item_type,
const void **item);
π DESCRIPTION π
so pam_get_item is the function that lets applications and PAM service modules access and retrieve PAM information of item_type. when it returns successfully, item has a pointer to the value of the corresponding item. π«Ά
β οΈ ok important, listen: this is a pointer to the actual data and it should NOT be free()'ed or over-written! like do not touch. i'm serious. π
these are the values you can pass for item_type:
PAM_SERVICEβ the service name, which is the thing that identifies that PAM stack that the PAM functions will use to authenticate the program. iconic.PAM_USERβ the username of the entity under whose identity service will be given. basically, after authentication,PAM_USERidentifies the local entity that gets to use the service. heads up though β this value can be mapped from something (eg.,"anonymous") to something else (eg."guest119") by any module in the PAM stack. so like, an application should consult the value ofPAM_USERafter each call to a PAM function. every time. fr fr. πPAM_USER_PROMPTβ the string used when prompting for a user's name. the default value for this string is a localized version of"login: ". πΈPAM_TTYβ the terminal name prefixed by/dev/for device files. in the past, graphical X-based applications used to store the$DISPLAYvariable here, but with the introduction ofPAM_XDISPLAYthis usage is deprecated. we don't do that anymore bestie. πPAM_RUSERβ the requesting user name: local name for a locally requesting user, or a remote user name for a remote requesting user. generally an application or module will attempt to supply the value that is most strongly authenticated (a local account before a remote one β the level of trust in this value is embodied in the actual authentication stack associated with the application, so it is ultimately at the discretion of the system administrator).PAM_RUSER@PAM_RHOSTshould always identify the requesting user. in some cases,PAM_RUSERmay beNULLβ and in such situations, it is unclear who the requesting entity is. πPAM_RHOSTβ the requesting hostname (the hostname of the machine from which thePAM_RUSERentity is requesting service). that is,PAM_RUSER@PAM_RHOSTdoes identify the requesting user. in some applications,PAM_RHOSTmay beNULL. in such situations, it is unclear where the authentication request is originating from. πPAM_AUTHTOKβ the authentication token (often a password). this token should be ignored by all module functions besidespam_sm_authenticate(3)andpam_sm_chauthtok(3). in the former function it is used to pass the most recent authentication token from one stacked module to another; in the latter function the token is used for another purpose β it contains the currently active authentication token. π₯PAM_OLDAUTHTOKβ the old authentication token. this token should be ignored by all module functions exceptpam_sm_chauthtok(3). periodt.PAM_CONVβ thepam_convstructure. seepam_conv(3). β¨
the following additional items are specific to Linux-PAM and should not be used in portable applications:
PAM_FAIL_DELAYβ a function pointer to redirect centrally managed failure delays. seepam_fail_delay(3). π¦PAM_XDISPLAYβ the name of the X display. for graphical, X-based applications the value for this item should be the$DISPLAYvariable. this value may be used independently ofPAM_TTYfor passing the name of the display. πPAM_XAUTHDATAβ a pointer to a structure containing the X authentication data required to make a connection to the display specified byPAM_XDISPLAY, if such information is necessary. seepam_xauth_data(3). βPAM_AUTHTOK_TYPEβ the default action is for the module to use the following prompts when requesting passwords:"New UNIX password: "and"Retype UNIX password: ". the example wordUNIXcan be replaced with this item, by default it is empty. this item is used bypam_get_authtok(3). π
π«Ά psst β if a service module wishes to obtain the name of the user, it should not use this function, but instead perform a call to pam_get_user(3). ok? ok.
π also, only a service module is privileged to read the authentication tokens,PAM_AUTHTOKandPAM_OLDAUTHTOK. like, it's giving VIP only. π
β¨ RETURN VALUES β¨
PAM_BAD_ITEMβ the application attempted to set an undefined or inaccessible item. rude.PAM_BUF_ERRβ memory buffer error. πPAM_PERM_DENIEDβ the value ofitemwasNULL.PAM_SUCCESSβ data was successful updated. slay! πPAM_SYSTEM_ERRβ thepam_handle_tpassed as first argument was invalid.
π¦ SEE ALSO π¦
pam_set_item(3), pam_strerror(3) β go read these next bestie, iykyk π
βΏ and that's the whole page βΏ β brought to you by Linux-PAM, version dated 07/08/2026, under the official PAM_GET_ITEM(3) header. mwah ππ
π¦ where this page comes from
- fedora 44: pam-devel 1.7.2-2.fc44 Β· BSD-3-Clause AND GPL-2.0-or-later
- fedora 44: pam-devel 1.7.2-2.fc44 Β· BSD-3-Clause AND GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms