PAM_NOLOGIN(8)

๐Ÿ’… pam_nologin โ€” from the PAM_NOLOGIN(8) girlies ๐ŸŽ€

okay so bestie, you're reading the Linux-PAM Manual page for pam_nologin, and honestly? it's giving "bouncer at the club door but for your whole system" ๐Ÿ”ฅ let's get into it.


โœจ NAME โœจ

pam_nologin โ€” no cap, this one is literally just Prevent non-root users from login ๐Ÿ’–


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

pam_nologin.so [file=/path/nologin] [successok]

she's short, she's sweet, she has two optional little arguments and she knows it โœจ


๐ŸŒธ DESCRIPTION ๐ŸŒธ

so here's the tea: pam_nologin is a PAM module that stops users from logging into the system whenever /var/run/nologin or /etc/nologin exists. that's the whole vibe check ๐Ÿ‘‘

and the contents of that file? they get displayed to the user ๐Ÿ“ข so if you want to leave a little note like "brb maintenance, come back later bestie", that's literally the mechanism, slay.

but โ€” and this is the important part โ€” the pam_nologin module has no effect on the root user's ability to log in. root stays in the club, always. main character energy fr fr ๐Ÿ’…


๐ŸŽ€ OPTIONS ๐ŸŽ€

  • file=/path/nologin โ€” use this file instead of the default /var/run/nologin or /etc/nologin. custom file, custom drama, we love options ๐Ÿซถ
  • successok โ€” return PAM_SUCCESS if no file exists. the default is PAM_IGNORE instead. that's it, that's the flag โœจ

๐Ÿ’œ MODULE TYPES PROVIDED ๐Ÿ’œ

the auth and account module types are provided. two icons, one module, periodt ๐ŸŽ€


๐ŸŒˆ RETURN VALUES ๐ŸŒˆ

  • PAM_AUTH_ERR โ€” the user is not root and /etc/nologin exists, so the user is not permitted to log in. door's closed babe ๐Ÿ˜ญ
  • PAM_BUF_ERR โ€” memory buffer error. not the vibe ๐Ÿ’€
  • PAM_IGNORE โ€” this is the default return value. the chill one ๐Ÿฆ‹
  • PAM_SUCCESS โ€” success: either the user is root or the nologin file does not exist. both paths are a W ๐Ÿ™Œ
  • PAM_USER_UNKNOWN โ€” user not known to the underlying authentication module. she doesn't know you like that ๐Ÿ™ˆ

โญ EXAMPLES โญ

the suggested usage for /etc/pam.d/login is:

auth  required  pam_nologin.so

short. iconic. copy it into your config and move on with your day ๐Ÿ’–


๐Ÿ”ฅ NOTES ๐Ÿ”ฅ

okay listen, this is the part where we get serious for a sec, no cap:

in order to make this module effective, all login methods should be secured by it. it should be used as a required method listed before any sufficient methods in order to get standard Unix nologin semantics. order matters, bestie, the stacking is real ๐Ÿ“š

and now the big warning: note that the use of the successok module argument causes the module to return PAM_SUCCESS, and as such would break such a configuration โ€” failing sufficient modules would lead to a successful login because the nologin module succeeded. like, the guard just let everyone in and called it a win ๐Ÿ˜ญ so be careful with successok, fr fr.

๐Ÿงš SEE ALSO ๐Ÿงš

nologin(5), pam.conf(5), pam.d(5), pam(8) โ€” go read your sisters, they're all icons in their own right ๐Ÿ’…


๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

pam_nologin was written by Michael K. Johnson <johnsonm@redhat.com>. thank you king ๐Ÿซถ


and that's the page, bestie!! this one came from the Linux-PAM manual, dated 09/27/2026, and honestly it ate. go forth and nologin responsibly ๐Ÿ’–โœจ๐ŸŽ€

๐Ÿ“ฆ where this page comes from