Pcornel
Browse topics
Options
Recent
Favorites
Linux · Technical reference

PAM

Direct answer

PAM (Pluggable Authentication Modules) is the stack of modules (/etc/pam.d/<service>) that services such as login, sshd and sudo use for authentication, account checks, sessions and password changes.

When to use this

Use it when logins fail unexpectedly, to add MFA or lockout, or to enforce password quality.

First 30 seconds

1. Which service file? /etc/pam.d/sshd, sudo, common-auth/system-auth.

2. Read the auth log: journalctl -u sshd / /var/log/secure.

3. Lockout? faillock --user <user>.

4. Change via authselect / pam-auth-update.

5. Test from a second session before logging out.

Operational verification

service calls PAM → auth modules → account checks → session setup → result

Evidence · next step

For Security → PAM, continue with the first unproven Topic check: Record exact host, distribution/kernel, boot ID, time window, workload, identity and the authoritative configuration/policy source for PAM. If that boundary is healthy, advance to the adjacent check: Read back the effective runtime state and precedence rather than assuming an edited file, package state or service status is active. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.

Continue only after interpreting the current observation.
Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
linux
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

Platformlinux
Scope / prerequisiteUse it when logins fail unexpectedly, to add MFA or lockout, or to enforce password quality.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

5 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Operational evidence path Verify boundary

PAM-aware service → service stack/includes → module order/control flags → authentication → account → session/password phase → application decision → audit/workload

Healthy evidence: the intended service resolves the expected stack, module control flow is understood, allowed/denied test identities behave correctly and logs correlate the decision

Step 2 Verification and output interpretation Verify boundary

Verification chain. PAM-aware service → service stack/includes → module order/control flags → authentication → account → session/password phase → application decision → audit/workload

Step 3 Commands Verify boundary
ls /etc/pam.d
grep -r pam_faillock /etc/pam.d
authselect current   # RHEL
Step 4 Failure modes and next checks Narrow the fault

Suspicious evidence: wrong service file/include is used, control flags bypass required checks, account/session phase differs from auth, module errors fail unexpectedly, or application behavior disagrees with PAM result

Step 5 Common mistakes Narrow the fault
  • Editing PAM files by hand on systems managed by authselect.
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points

Module order and control flags (required, requisite, sufficient) decide the result. On RHEL edit via authselect, on Debian via pam-auth-update — not by hand. Always keep a root session open when changing PAM.

Key checks
  • faillock --user <user> — failed-login lockout state
  • sestatus / aa-status — SELinux or AppArmor state
  • ss -tulpn — listening services
  • journalctl -u sshd -g 'Failed' — failed logins
  • ausearch -m avc,user_login -ts today — audit events (auditd)
ReferenceWhat it is1 section · depth on demand

Scope and canonical references

This is the canonical Linux PAM Topic (Pluggable Authentication Modules): stacks, module types, control flags and authselect.

ReferenceImportant terms & boundaries5 sections · depth on demand

What this shows and what it does not

PAM is confirmed only for the exact participating service and phase under test, but it does not show non-PAM authentication paths or application authorization beyond the returned PAM result.

In depth

PAM: how Linux authentication is assembled

PAM (Pluggable Authentication Modules) lets each program that authenticates users, such as login, sshd, sudo or su, use a configurable stack of modules. The pam.conf(5) manual page describes the configuration:

  • Each service has a file in /etc/pam.d/, named after the service.
  • Each line has a type, a control value, a module path and arguments.
  • The four types are auth (verify identity), account (allowed now?), password (change credentials) and session (set up and tear down the session).
  • Lines of the same type are evaluated in order.

Control values (manual)

ControlEffect
requiredMust succeed, but the remaining modules still run, and failure is reported at the end
requisiteMust succeed; failure returns immediately
sufficientSuccess ends the stack (if nothing required failed before); failure is ignored
optionalMatters only if it's the only module of that type
include / substackPull in lines from another file
[success=1 default=ignore]The bracket syntax, for exact control (used heavily by Debian)

A - before the type, for example -session, keeps PAM from logging an error if the module isn't installed.

Common modules

ModulePurpose
pam_unixLocal passwords from /etc/shadow
pam_sssSSSD (AD and LDAP users)
pam_faillockLock accounts after failed attempts (RHEL family)
pam_pwqualityPassword strength rules
pam_limitsResource limits from /etc/security/limits.conf
pam_accessAllow or deny logins by user and origin (/etc/security/access.conf)
pam_google_authenticator / pam_u2fSecond factor
pam_mkhomedirCreate home directories at first login

Changing PAM safely

PracticeReason
Use the distribution's tools: authselect (RHEL), pam-auth-update (Debian)They keep the stacks consistent
Keep a root shell open while testingA broken stack can lock everyone out
Test each service: ssh, sudo, consoleThey use different files
host$ cat /etc/pam.d/sshd | grep -vE '^\s*(#|$)'
@include common-auth
account    required     pam_nologin.so
@include common-account
session    required     pam_limits.so
@include common-session
host$ grep -vE '^\s*(#|$)' /etc/pam.d/common-auth
auth    [success=2 default=ignore]      pam_unix.so nullok
auth    [success=1 default=ignore]      pam_sss.so use_first_pass
auth    requisite                       pam_deny.so
auth    required                        pam_permit.so
host$ sudo authselect current
host$ sudo faillock --user alice
host$ sudo journalctl -t sshd -g "pam_" --since today | tail -3

Reading common-auth

[success=2 default=ignore] means: if pam_unix succeeds, skip the next two lines and land on pam_permit. If it fails, try pam_sss, which on success skips one line. If both fail, pam_deny ends the stack with an error. That's how Debian expresses "local password or directory password".

Documented example, not captured output.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

How it works at runtime

PAM is part of Security → PAM. PAM is the Linux authentication/account/session/password stack used by PAM-aware services, where module order, control flags, includes and application integration determine the effective decision.

Runtime state ownership and mechanics. Linux security composes authentication (PAM and service mechanisms), identity/credentials, DAC permissions/ACLs, capabilities, LSM policy such as SELinux/AppArmor, audit and service/network policy.

Topic-specific state model. PAM is the Linux authentication/account/session/password stack used by PAM-aware services, where module order, control flags, includes and application integration determine the effective decision.

Technical metadata. Linux distribution/kernel + boot/time + user/group/process/service identity + PAM/SSH/DAC/ACL + SELinux/AppArmor mode/context/profile + audit/log correlation + key/certificate/SAN/EKU/chain/trust store/SNI + original workload result.

Interpretation rule. - A PAM configuration file exists ≠ the target service uses that stack.

  • One module returns success ≠ the whole auth/account/session flow succeeds or is authorized.

Quick reference

PAM (Pluggable Authentication Modules) chains modules per service in /etc/pam.d/<service> across four types: auth, account, password, session. Control flags decide the outcome:

FlagMeaning
requiredMust succeed; continue, fail at end
requisiteMust succeed; fail immediately
sufficientSuccess ends the stack (if nothing required failed)
optionalOnly matters if it is the only module
include / substackPull in another file
# lockout after 5 failures (RHEL 8+/Debian 12)
auth required pam_faillock.so preauth deny=5 unlock_time=900
faillock --user alice; faillock --user alice --reset

On RHEL use authselect to manage PAM profiles rather than editing files by hand; always keep a root shell open while testing PAM changes.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Limits and how it fails

Primary failure point. PAM is confirmed only for the exact participating service and phase under test, but it does not show non-PAM authentication paths or application authorization beyond the returned PAM result.

PAM success does not show sudo, filesystem or application authorization. Security controls should remain explicit layers rather than a single “permission denied” bucket.

ReferenceConfiguration & state1 section · depth on demand

Configuration, persistence and lifecycle

PAM stack order/control flags matter; sudo/SSH hardening can lock out administration; SELinux policy should normally be fixed through correct labels/booleans/policy rather than permanent disablement; AppArmor profiles should move from complain to enforce only after reviewing legitimate workload behavior.

Distribution/platform context. PAM owns stack evaluation; SSH, sudo, login/display managers and applications own their integration and post-auth authorization.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor doclinux current

Authoritative/upstream documentation reviewed for bounded claims in Security → PAM. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://docs.kernel.org/security/index.html · confidence 94%
Technical changelog & impact

What changed and what may be affected

Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.

Related reference impactReview these references after material technical changes when their shared boundary is affected.
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
PAMlinux pampluggable authentication modulespam stack linux
Embedded reference data

Quick lookup tables

PAM operational reference

Topic-specific lookup boundaries, proof limits and next-step Evidence for PAM.

Lookup boundaryTopic-specific referenceOperational use
Scope / effective statePAM is the Linux authentication/account/session/password stack used by PAM-aware services, where module order, control flags, includes and application integration determine the effective decision.Establish exactly what this Topic owns before crossing into another subsystem.
Fast verificationPin host + boot/time + real identity/workload → identify authoritative policy/key/trust source → read back loaded/effective runtime state → reproduce one safe allow/deny/handshake test → correlate audit/service/kernel evidence → locate first failed boundary → make the smallest persistent change → repeat original workload + regression/recovery check.Use the shortest evidence path first; a fast check is a boundary test, not blanket proof.
Verification chainPAM-aware service → service stack/includes → module order/control flags → authentication → account → session/password phase → application decision → audit/workloadTrace requested/configured state through effective state to the observed workload result.
Failure boundaryPAM is proven only for the exact participating service and phase under test; it does not prove non-PAM authentication paths or application authorization beyond the returned PAM result.Stop broad troubleshooting at the first boundary that is not supported by evidence.
Positive evidenceCorrelated Linux security/trust evidence can establish this proof path: PAM-aware service → service stack/includes → module order/control flags → authentication → account → session/password phase → application decision → audit/workloadUse this observation only for the specific claim it actually supports.
Evidence limitIt does not independently prove unobserved identities, objects, policies, namespaces, endpoints or time periods. PAM is proven only for the exact participating service and phase under test; it does not prove non-PAM authentication paths or application authorization beyond the returned PAM result.Do not promote a local success signal into end-to-end or adjacent-dependency proof.
Next troubleshooting checkContinue from the first unproven security/trust boundary, capture the adjacent effective state and audit/handshake evidence, make only the demonstrated persistent change, then repeat the original workload plus recovery/regression checks.Continue to the next unresolved boundary while preserving the original test condition.

PAM · operational reference

Compact Linux state, persistence, verification and boundary reference for fast lookup.

Reference boundaryPAM
Topic pathSecurity → PAM
Runtime statePAM is the Linux authentication/account/session/password stack used by PAM-aware services, where module order, control flags, includes and application integration determine the effective decision.
Fast checks- Record exact host, distribution/kernel, boot ID, time window, workload, identity and the authoritative configuration/policy source for PAM. - Read back the effective runtime state and precedence rather than assuming an edited file, package state or service status is active. - Reproduce one safe allowed/denied or handshake/access test and correlate kernel/service/audit evidence at the first relevant boundary. - Apply the smallest persistent cause-specific change, then repeat the original test plus an adjacent regression/recovery check.
Verification chainPAM-aware service → service stack/includes → module order/control flags → authentication → account → session/password phase → application decision → audit/workload Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return path or regression → explicit Evidence boundary.
Failure boundaryPAM is proven only for the exact participating service and phase under test; it does not prove non-PAM authentication paths or application authorization beyond the returned PAM result. Boundary chain: process/context → userspace configuration → kernel subsystem/resource → device/network/filesystem dependency → effective state → original workload.
Persistence ruleProve which configuration source owns the state, then prove that the running consumer loaded or generated the intended state.
Confirmation

Confirm action

Continue?