PAM is the part of Linux that checks who you are each time you log in.
This guide is for students, new IT staff and anyone curious about what happens when they type a password into a Linux machine. If your business runs a website or app, it very likely runs on Linux, and PAM decides who gets in.
In short
- PAM stands for Pluggable Authentication Modules. It is a set of small checks that run when someone logs in.
- Each program, such as the remote login service, has its own list of checks in a settings file.
- The checks run in order: who are you, are you allowed in, then set up your session.
- One wrong line in these files can lock everyone out or let the wrong people in, so changes need care and testing.
What you will learn
- Explain what PAM does in one sentence.
- Spot the four kinds of check PAM runs.
- Explain why a small change to a PAM file can have a big effect.
- Ask the right questions before anyone edits login settings.
- Proving who you are (authentication)
- showing a system you are the person you claim to be, often with a password.
- Plug-in check (module)
- one small program that does one check, such as testing a password.
- Check list (stack)
- the list of plug-in checks a program runs, from top to bottom.
What is PAM?
Think of the checks at an airport. One desk checks your passport. Another checks you have a ticket for today. Then staff at the gate get you seated.
PAM works the same way for a Linux machine. When you log in, Linux does not do all the checking itself. It hands the job to PAM, short for Pluggable Authentication Modules. PAM is a shared set of checks that programs like the login screen and the remote login service can use.[1]
Each check is a small module, a plug-in that does one job. The person who looks after the machine, called the administrator, chooses which modules each program uses by editing settings files. They do not need to change the programs themselves.[1]
Where the comparison stops working: at an airport, the desks are in fixed places. In PAM, an administrator can add, remove or reorder checks by changing a few lines. That makes PAM flexible, and also easy to get wrong.
Why does it matter?
PAM is the front door of many Linux machines. If its settings are wrong, the door may lock everyone out, or open too easily.
If you are a student or learning Linux
What could happen: you copy a PAM change from a forum and lock yourself out of your own test machine.
Check this: keep a second session open while you test any login change.
If you are new to IT support
What could happen: a user cannot log in, and nobody knows which check refused them.
Check this: learn where your systems record login problems, and look there first.
If you manage a team that runs Linux servers
What could happen: an unchecked change lets old accounts log in, or turns off the lock after too many wrong passwords.
Check this: make sure login setting changes are reviewed and tested before they go live.
What does it look like?
Each program that uses PAM has its own settings file. Here is a simplified, made-up one for a remote login service.
Example only. All values are made up.
# PAM settings for the remote login service (EXAMPLE, simplified) auth required pam_faillock.so (1) auth required pam_unix.so (2) account required pam_unix.so (3) password required pam_unix.so (4) session required pam_limits.so (5)
- A check that counts wrong passwords and can lock the account for a while.[3]
- The "who are you?" check. In a real file, this line would test the password against the machine's own records.
- The "are you allowed in?" check, for example whether the account has expired.
- The check used when someone changes their password.
- Session set-up, such as limits on what the person can use once inside.
Why this is risky: the word in the second column changes the meaning. Swap "required" for a weaker word on the wrong line, and a failed check may no longer stop a login.[2]
The safer way: use the tool your Linux version provides to manage these files where one exists. Test every change on a spare machine first, and keep a way back in.[4]
How does it work?
PAM groups its checks into four kinds.[1] Here is what happens when someone logs in.
- A program asks PAM. The login screen or remote login service passes the login attempt to PAM.
- PAM reads the program's file. Each program has its own file in a folder called
/etc/pam.d.[2] - Who are you? The "auth" checks run, such as testing a password or a one-time code.
- Are you allowed in? The "account" checks ask whether this account may log in now, for example if it has expired.
- Set up the session. The "session" checks prepare things before you start and tidy up when you leave, such as writing a record.
- Yes or no. PAM sends one answer back to the program, which lets you in or refuses. A fourth kind, "password", runs only when you change your password.

Each line also carries a word that says how much that check matters. "Required" means a failure will end in a refusal, though the other checks still run. "Requisite" means a failure stops the list at once. "Sufficient" means a pass can be enough on its own, if nothing required has failed.[2] Small changes to these words can change who gets in.
Many companies connect Linux machines to a central staff directory, so people use one company account everywhere. On many systems a service called SSSD does that link, and PAM calls it during the checks.[4]
Software uses Linux machines too. Backup jobs, apps and scripts often run under service accounts, a type of non-human identity (NHI) that lets software act without a person. Many connect with an SSH key instead of a password. On a common set-up, the key check happens outside PAM, but PAM's "account" and "session" checks still run.[5] So an expired or locked account can still be refused, even with a valid key.
A worked example
Xena Falk has just joined a fictional web design firm as its first IT support hire. On Monday, nobody can reach the firm's Linux web server from home.
Her manager, Milo Thorne, tells her a contractor "tidied up some login settings" on Friday. Xena thinks of the airport. Somebody has moved one of the desks.
Luckily, a team member still has a session open from before the change. Xena asks them to leave it open, so there is a way back in.
She looks at the login records first. They show the "who are you?" check failing for every person, even with the right password.
Next, she compares the remote login settings file with the copy from last week's backup. One line has been changed. A check that should only run for one special case is now marked "requisite", so it stops every login at once.
Xena puts the line back the way it was. Before she closes anything, she opens a brand new session to test it. The login works.
Milo asks how to stop this happening again. Xena suggests three rules. Changes to login settings are tested on a spare machine first. A second person reviews them. Somebody always keeps a working session open until the new one is proven.
Myths and mistakes
| What people think | What is true |
|---|---|
| PAM is only about passwords. | PAM also checks whether an account may log in now, and sets up and records the session.[1] |
| Every program shares one PAM file. | Each program has its own file, though files can pull in shared lists.[2] |
| The order of lines does not matter. | Checks run from top to bottom, and the order can change the result.[2] |
| It is fine to edit any PAM file by hand. | Some Linux versions manage these files with a tool, and hand edits can be overwritten. Use the tool where one exists.[4] |
| Logging in with an SSH key skips PAM completely. | On a common set-up, the account and session checks still run when an SSH key is used.[5] |
What can I do this week?
- On a test machine, open the
/etc/pam.dfolder and read one file. Try to spot the four kinds of check. - Find out where your Linux machines record failed logins.
- Ask whether your team uses a tool to manage login settings, and who may change them.
- Agree a simple rule: keep a working session open while testing any login change.
Checklist
- We know which Linux machines we run and who looks after them.
- Changes to PAM settings are tested on a spare machine first.
- A second person reviews every change to login settings.
- We keep a backup copy of the PAM files from before each change.
- Failed logins are recorded and someone checks them.
- Accounts are locked for a while after too many wrong passwords.
- Service accounts used by software have an owner and only the access they need.
Common questions
What does PAM stand for in Linux?
PAM stands for Pluggable Authentication Modules. It is a set of shared checks that Linux programs use to decide who may log in. Do not mix it up with privileged access management, a different security topic that also uses the letters PAM.
Where are the PAM settings files?
On most Linux systems they live in the /etc/pam.d folder. Each file is named after the program it controls, such as the login screen. Some systems also keep default copies elsewhere, and a file in /etc/pam.d takes priority over them.[2]
Why did I get locked out after a few wrong passwords?
A lockout check was probably doing its job. Many systems use a PAM module that counts wrong passwords in a row and locks the account for a set time. Wait for the lock to end, or ask an administrator to unlock you.[3]
Can PAM add a second check, like a one-time code?
Yes, that is one of the main reasons PAM exists. An administrator can add a module that asks for a one-time code after the password. The programs do not need to change, only the PAM settings.[1]
How is PAM different from SSSD?
They work together. PAM runs the list of checks for each login. SSSD is a service that connects the machine to a central staff directory. PAM can call SSSD during its checks, so people log in with their company account.[4]
Where next?
Ready for the detail? Read the practitioner guide: SSSD and Linux Active Directory Integration Guide. It goes further into joining Linux machines to a company directory, how SSSD and PAM fit together, and how to troubleshoot sign-in problems at scale.
Also useful:
Related NHI Mgmt Group resources: Linux Service Accounts and Keytab Management Guide · Linux SSH and Authentication Log Detection Guide · LDAP for Beginners
Key terms
- Linux PAM
- The set of shared plug-in checks Linux programs use to decide who may log in.
- Authentication
- Proving you are who you claim to be, for example with a password.
- Password
- A secret a person knows that proves who they are.
- Account lockout
- Blocking an account for a time after too many wrong passwords.
- SSSD
- A Linux service that connects a machine to a central directory of accounts.
- sshd
- The program on a Linux machine that accepts remote logins over SSH.
- Service account
- An account that software uses to do its job without a person.
Sources and further reading
- pam(8), Linux-PAM manual page. Linux man-pages project (man7.org). https://www.man7.org/linux/man-pages/man8/pam.8.html, accessed 28 Nov 2026.
- pam.conf(5), PAM configuration files manual page. Linux man-pages project (man7.org). https://www.man7.org/linux/man-pages/man5/pam.conf.5.html, accessed 28 Nov 2026.
- pam_faillock(8) manual page. Linux man-pages project (man7.org). https://www.man7.org/linux/man-pages/man8/pam_faillock.8.html, accessed 28 Nov 2026.
- Configuring user authentication using authselect. Red Hat Enterprise Linux 9 documentation, Red Hat. https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html/configuring_authentication_and_authorization_in_rhel/configuring-user-authentication-using-authselect_configuring-authentication-and-authorization-in-rhel, accessed 28 Nov 2026.
- sshd_config(5), UsePAM. Debian manual pages (openssh-server, bookworm). https://manpages.debian.org/bookworm/openssh-server/sshd_config.5.en.html, accessed 28 Nov 2026.