{
    "mode": "info",
    "parameter": "pam_sm_setcred",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/info/pam_sm_setcred/json",
    "generated": "2026-07-05T11:18:59Z",
    "synopsis": "#include <security/pammodules.h>\nint pamsmsetcred(pamhandlet *pamh, int flags, int argc,\nconst char argv);",
    "sections": {
        "NAME": {
            "content": "pamsmsetcred - PAM service function to alter credentials\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "#include <security/pammodules.h>\n\nint pamsmsetcred(pamhandlet *pamh, int flags, int argc,\nconst char argv);\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The pamsmsetcred function is the service module's implementation of\nthe pamsetcred(3) interface.\n\nThis function performs the task of altering the credentials of the user\nwith respect to the corresponding authorization scheme. Generally, an\nauthentication module may have access to more information about a user\nthan their authentication token. This function is used to make such\ninformation available to the application. It should only be called\nafter the user has been authenticated but before a session has been\nestablished.\n\nValid flags, which may be logically OR'd with PAMSILENT, are:\n\nPAMSILENT\nDo not emit any messages.\n\nPAMESTABLISHCRED\nInitialize the credentials for the user.\n\nPAMDELETECRED\nDelete the credentials associated with the authentication service.\n\nPAMREINITIALIZECRED\nReinitialize the user credentials.\n\nPAMREFRESHCRED\nExtend the lifetime of the user credentials.\n\nThe way the auth stack is navigated in order to evaluate the\npamsetcred() function call, independent of the pamsmsetcred() return\ncodes, is exactly the same way that it was navigated when evaluating\nthe pamauthenticate() library call. Typically, if a stack entry was\nignored in evaluating pamauthenticate(), it will be ignored when\nlibpam evaluates the pamsetcred() function call. Otherwise, the return\ncodes from each module specific pamsmsetcred() call are treated as\nrequired.\n",
            "subsections": []
        },
        "RETURN VALUES": {
            "content": "PAMCREDUNAVAIL\nThis module cannot retrieve the user's credentials.\n\nPAMCREDEXPIRED\nThe user's credentials have expired.\n\nPAMCREDERR\nThis module was unable to set the credentials of the user.\n\nPAMSUCCESS\nThe user credential was successfully set.\n\nPAMUSERUNKNOWN\nThe user is not known to this authentication module.\n\nThese, non-PAMSUCCESS, return values will typically lead to the\ncredential stack failing. The first such error will dominate in the\nreturn value of pamsetcred().\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "pam(3), pamauthenticate(3), pamsetcred(3), pamsmauthenticate(3),\npamstrerror(3), PAM(8)\n\nLinux-PAM Manual                  06/08/2020                 PAMSMSETCRED(3)",
            "subsections": []
        }
    },
    "summary": "pamsmsetcred - PAM service function to alter credentials",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "pam",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/pam/3/json"
        },
        {
            "name": "pamauthenticate",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/pamauthenticate/3/json"
        },
        {
            "name": "pamsetcred",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/pamsetcred/3/json"
        },
        {
            "name": "pamsmauthenticate",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/pamsmauthenticate/3/json"
        },
        {
            "name": "pamstrerror",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/pamstrerror/3/json"
        },
        {
            "name": "PAM",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/PAM/8/json"
        }
    ]
}