PAM_SM_CHAUTHTOK(3)
π PAM_SM_CHAUTHTOK π
okay so bestie, we're in the <security/pam_modules.h> era and this is the Linux-PAM Manual page for pam_sm_chauthtok β the PAM service function for authentication token management. yes it's a mouthful. no we're not skipping it. let's go β¨
πΈ SYNOPSIS πΈ
#include <security/pam_modules.h>
int pam_sm_chauthtok(pam_handle_t *pamh, int flags, int argc,
const char **argv);
π DESCRIPTION π
so pam_sm_chauthtok is literally the service module's own implementation of the pam_chauthtok(3) interface. it's the glow-up function β it's used to (re-)set the authentication token of the user. new password, who dis π
the valid flags, which you can logically OR together with PAM_SILENT, are:
PAM_SILENTβ do not emit any messages. not a peep. silent era, main character energy, no β¨ chatter β¨PAM_CHANGE_EXPIRED_AUTHTOKβ this argument tells the module that the user's authentication token (password) should only be changed if it has expired. this flag is optional and must be combined with one of the following two flags. but heads up π«Ά β the following two options are mutually exclusive, so pick one, not both, bestie.PAM_PRELIM_CHECKβ this indicates that the modules are being probed as to their ready status for altering the user's authentication token. if the module needs access to another system over some network, it should attempt to verify it can connect to this system on receiving this flag. if a module can't establish that it's ready to update the user's authentication token, it should returnPAM_TRY_AGAIN, and this information gets passed back to the application.
also important: if the control valuesufficientis used in the password stack, thePAM_PRELIM_CHECKsection of the modules following that control value is not always executed. lowkey a vibe check with a catch π«
PAM_UPDATE_AUTHTOKβ this informs the module that this is the call where it should change the authorization tokens. if the flag is logically OR'd withPAM_CHANGE_EXPIRED_AUTHTOK, the token is only changed if it has actually expired. no expired token, no change. periodt.
the PAM library calls this function twice in succession π β first with PAM_PRELIM_CHECK, and then, if the module does not return PAM_TRY_AGAIN, subsequently with PAM_UPDATE_AUTHTOK. it's only on the second call that the authorization token is (possibly) changed. so yes, it's a two-episode arc and the token only gets its makeover in part two π
π¦ RETURN VALUES π¦
PAM_AUTHTOK_ERRβ the module was unable to obtain the new authentication token. πPAM_AUTHTOK_RECOVERY_ERRβ the module was unable to obtain the old authentication token. πPAM_AUTHTOK_LOCK_BUSYβ cannot change the authentication token since it is currently locked. it's booked and busy, try later πPAM_AUTHTOK_DISABLE_AGINGβ authentication token aging has been disabled.PAM_PERM_DENIEDβ permission denied. you shall not pass π«PAM_TRY_AGAINβ preliminary check was unsuccessful. signals an immediate return to the application is desired.PAM_SUCCESSβ the authentication token was successfully updated. ate. no crumbs. πPAM_USER_UNKNOWNβ user unknown to password service. who is she? π€
β SEE ALSO β
pam(3), pam_chauthtok(3), pam_sm_chauthtok(3), pam_strerror(3), PAM(8)
and that's the whole page bestie, go forth and manage those tokens responsibly π§π
signed, sealed, delivered by Linux-PAM β dated 07/08/2026 β mwah, talk later ππ
π¦ 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