PAM_LIMITS(8)

๐Ÿ’– NAME ๐Ÿ’–

pam_limits โ€” bestie, it's the PAM module that puts a cap on your system resources ๐Ÿ”ฅ


โœจ SYNOPSIS โœจ

pam_limits.so [conf=/path/to/limits.conf] [debug] [set_all] [utmp_early]
              [noaudit]

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

okay so here's the tea: pam_limits is a PAM module that sets limits on the system resources you can grab in a user-session. and yes, even users with uid=0 are affected by these limits โ€” no one is above the limit law, not even root ๐Ÿ’…

by default, limits get pulled from the /etc/security/limits.conf config file. then the individual *.conf files in the /etc/security/limits.d/ directory get read too. these files are parsed one after another in the order of the "C" locale. and the effect of all the individual files is the same as if you'd concatenated them all together in parsing order. BUT โ€” if you explicitly specify a config file with a module option, then the files in that directory are not parsed. periodt.

โš ๏ธ important: this module must not be called by a multithreaded application. like, don't. that's the rule.

and if Linux PAM is compiled with audit support, the module will report when it denies access based on the limit of maximum number of concurrent login sessions ๐Ÿ‘€


๐ŸŽ€ OPTIONS ๐ŸŽ€

  • conf=/path/to/limits.conf โ€” point at an alternative limits.conf-style config file to override the default one ๐Ÿ—‚๏ธ
  • debug โ€” print debug info. classic. ๐Ÿ”
  • set_all โ€” sets the limits for which no value is specified in the config file to the one from the process with the PID 1. but heads up bestie: if the init process is systemd, these limits will not be the kernel default limits, and you should not use this option ๐Ÿ™ˆ
  • utmp_early โ€” some broken applications actually allocate a utmp entry for the user before the user is admitted to the system. if some of the services you're configuring PAM for do this, you can selectively use this module argument to compensate for that behavior, and at the same time keep system-wide consistency with a single limits.conf file ๐Ÿงš
  • noaudit โ€” don't report exceeded maximum logins count to the audit subsystem ๐Ÿคซ

๐Ÿ‘‘ MODULE TYPES PROVIDED ๐Ÿ‘‘

only the session module type is provided. that's it. that's the whole list. ๐Ÿ’€


๐ŸŒˆ RETURN VALUES ๐ŸŒˆ

  • PAM_ABORT โ€” cannot get current limits ๐Ÿ˜ญ
  • PAM_IGNORE โ€” no limits found for this user ๐Ÿคท
  • PAM_PERM_DENIED โ€” new limits could not be set ๐Ÿšซ
  • PAM_SERVICE_ERR โ€” cannot read config file ๐Ÿ“„
  • PAM_SESSION_ERR โ€” error recovering account name ๐Ÿ˜ต
  • PAM_SUCCESS โ€” limits were changed, slay โœจ
  • PAM_USER_UNKNOWN โ€” the user is not known to the system ๐Ÿ‘ป

๐Ÿ“ FILES ๐Ÿ“

  • /etc/security/limits.conf โ€” the default configuration file ๐Ÿ’–

๐ŸŒธ EXAMPLES ๐ŸŒธ

for the services where you need resource limits (login, for example), put the following line in /etc/pam.d/login as the last line for that service โ€” usually after the pam_unix session line:

#%PAM-1.0
#
# Resource limits imposed on login sessions via pam_limits
#
session  required  pam_limits.so

and then just replace "login" for each service you're using this module with ๐Ÿซถ


โญ SEE ALSO โญ

limits.conf(5), pam.d(5), pam(8).


๐Ÿ’œ AUTHORS ๐Ÿ’œ

pam_limits was initially written by Cristian Gafton <gafton@redhat.com> โ€” iconic behavior, we love to see it ๐Ÿ’…


and that's the whole vibe check bestie โ€” this is from the Linux-PAM crew, dated 09/27/2026, and it's giving documentation excellence. mwah. ๐ŸŽ€โœจ

๐Ÿ“ฆ where this page comes from