configuration

PAM service files — Authentication stacks

PAM service files under /etc/pam.d describe ordered module stacks for applications using PAM. auth checks authentication; account evaluates access constraints; password handles credential changes; session handles session setup and teardown. required failures are remembered while the stack continues; requisite failure normally terminates immediately; sufficient success can short-circuit when no earlier required failure exists; optional is usually not decisive. Extended controls, includes and substacks require the exact PAM semantics. Service-specific files override vendor equivalents; distribution-managed common stacks may be included. A malformed change can lock out administrators. Never use a permit-all module as a workaround. The fixture only extracts an intentionally fictional stack; it cannot validate authentication. In an authorized VM keep a recovery console, use the distro’s policy tooling, test both permitted and denied access, and restore the previous stack and generated configuration if verification fails.

Formal Syntax & Structure

linux syntaxlinux
TYPE CONTROL MODULE [ARGUMENTS]

Parameters & Attributes

NameTypeDescription
typedirective or fieldauth, account, password or session
controldirective or fieldResult handling
moduledirective or fieldModule name or path
argumentsdirective or fieldModule-specific options

Return Value

configuration or inspection

Stack declaration, not authentication outcome.

Working Example

Example Snippetlinux
set -eud=$(mktemp -d)trap 'rm -rf -- "$d"' EXITcat > "$d/demo-pam" <<'EOF'auth required pam_unix.soaccount required pam_unix.soEOFawk '{print $1 ": " $2 " " $3}' "$d/demo-pam"
Linux Reference