PAM_SESSION_TIMELIMI(8)
π pam_session_timelimit, bestie π
okay so this is a manual page from section 8 of the System Managers Manual, and it's genuinely iconic β it's the whole "you've had enough screen time today, sweetie" of the Linux PAM world. Buckle up π
πΈ NAME πΈ
pam_session_timelimit β the module that puts daily time limits on user sessions. no cap, it's literally a bedtime for logins π
β¨ SYNOPSIS β¨
pam_session_timelimit.so [...]
π¦ DESCRIPTION π¦
So the pam_session_timelimit PAM module talks to systemd and limits how long a user can use a service. And bestie, listen β this is a per-day time limit. Every session you start chips away at the limit, so each new session has less time left for the rest of that day. it's giving "shared bank account but the currency is minutes" π
The time a session used is only recorded at the session end. Which means β and this is important, don't @ me β it is possible to exceed the absolute limit by launching sessions in parallel. so like, yes, the loophole is real, and yes, the manpage knows. π
By default, the settings for per-user session time limits come from the config file /etc/security/time_limits.conf. Wanna use a different one? Just pass the path option. easy.
Time limits in that config file are written using the syntax described in systemd.time(7) β so go read that if the format is confusing you, queen.
Also: the config file format does not support configuring different time limits for different services. To pull that off, you use different path options for each service. that's the move π«Ά
π₯ OPTIONS π₯
path=/path/to/time_limits.confβ point the module at an alternative configuration file that follows thetime_limits.confformat, overriding the default. alternate config, main character energy β¨statepath=/path/to/session_stateβ point the module at an alternative state file, which is where it records each user's used session time for the day. it's the receipts folder π§Ύ
π MODULE TYPES PROVIDED π
The account and session module types are provided. just those two, and honestly? they ate.
π RETURN VALUES π
PAM_SUCCESSβ Access was granted. slay, go forth πPAM_PERM_DENIEDβ The user is not allowed access at this time. (the "not right now bestie" of return codes)PAM_BUF_ERRβ Memory buffer error. πPAM_SYSTEM_ERRβ An unexpected error was encountered. πPAM_SESSION_ERRβ The session was not opened correctly and therefore cannot be closed correctly. messy.PAM_BAD_ITEMβ The module could not identify the user to be given access. who even are you πPAM_IGNOREβ No session limit has been configured for this user. free bird π¦
π FILES π
/etc/security/time_limits.confβ Default configuration file β/var/lib/session_timesβ Default state file β
π EXAMPLES π
okay here's the actual setup, copy it exactly, no freelancing:
#%PAM-1.0
#
# apply pam_session_timelimit accounting to login requests
#
login account required pam_session_timelimit.so
login session required pam_session_timelimit.so
π«Ά SEE ALSO π«Ά
systemd.time(7), pam.d(5), pam(7).
go read them, iykyk πΈ
π AUTHOR π
pam_session_timelimit was written by Steve Langasek <vorlon@dodds.net>. thank you king π
heads up bestie: the per-day limit is recorded only at session end, so parallel sessions can blow past the absolute limit. that's not a bug note, that's just how it is. π
and that's the whole page!! this one shipped in the System Manager's Manual, dated 01/26/2026, sitting pretty under PAM_SESSION_TIMELIMI(8) β section 8, always. periodt. πβ¨π
π¦ where this page comes from
- ubuntu resolute: pam-session-timelimit 0.7-4build1 Β· LGPL-3.0-or-later
- ubuntu stonking: pam-session-timelimit 0.7-4build1 Β· LGPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms