PAM_LASTLOG(8)
๐ PAM_LASTLOG(8) ๐
okay bestie, gather round, because we're about to talk about pam_lastlog โ that's the Linux-PAM Manual page for the lastlog module, and yes she's a whole vibe. ๐
โจ NAME โจ
pam_lastlog โ a PAM module that shows you the date of your last login and does the inactive-account lockout thing. she does both. she's multitasking. ๐
๐ธ SYNOPSIS ๐ธ
pam_lastlog.so [debug] [silent] [never] [nodate] [nohost] [noterm]
[nowtmp] [noupdate] [showfailed] [inactive=<days>]
[unlimited]
look at all those brackets, so many options, she's flexible fr fr ๐ฆ
๐ DESCRIPTION ๐
okay so pam_lastlog is a PAM module that displays a line of info about the user's last login. and on top of that, she also maintains the /var/log/lastlog file. upkeep queen ๐
some applications do this whole thing themselves, lowkey. and in those cases? this module is not necessary. so don't be extra. ๐
here's the tea: the module checks the LASTLOG_UID_MAX option in /etc/login.defs, and it does not update or display last login records for users whose UID is higher than that value. if the option isn't there, or its value is invalid, then no user ID limit gets applied at all. no cap. โจ
and if the module gets called in the auth or account phase? then accounts that weren't used recently enough get disallowed from logging in ๐. but โ and this is important โ the check is not performed for the root account, so root never gets locked out. also not performed for users with a UID higher than the LASTLOG_UID_MAX value. periodt.
๐ OPTIONS ๐
debugโ prints debug information. she's telling you everything, oversharing era ๐ฌsilentโ don't tell the user about any previous login, just update the/var/log/lastlogfile. ngl this one does not affect the display of bad login attempts, so those still show up.neverโ if the/var/log/lastlogfile has no old entries for the user, say that the user has never previously logged in, with a welcome message. aww. ๐ซถnodateโ don't display the date of the last login. keeping it mysterious โจnotermโ don't display the terminal name where the last login was attempted.nohostโ don't indicate which host the last login was attempted from.nowtmpโ don't update the wtmp entry.noupdateโ don't update any file. zero updates. none. ๐showfailedโ display the number of failed login attempts and the date of the last failed attempt from btmp. (the date is not displayed whennodateis specified, so keep that in mind bestie)inactive=<days>โ this one is specifically for the auth or account phase. it sets how many days after the user's last login the user gets locked out by the module. the default value is90. ninety. ninety days of not logging in and you're out ๐ชunlimitedโ if the fsize limit is set, this option can override it, which prevents failures on systems with large UID values that lead lastlog to become a huge sparse file. huge sparse file is giving chaos ngl ๐ญ
๐ MODULE TYPES PROVIDED ๐
the auth and account module types let you lock out users who didn't log in recently enough. ๐
the session module type is provided for displaying the info about the last login and/or updating the lastlog and wtmp files. ๐
โญ RETURN VALUES โญ
PAM_SUCCESSโ everything was successful. we love a happy ending ๐PAM_SERVICE_ERRโ internal service module error. not her fault, it's internal ๐ญPAM_USER_UNKNOWNโ user not known. who is she?? ๐PAM_AUTH_ERRโ user locked out in the auth or account phase due to inactivity.PAM_IGNOREโ there was an error while reading the lastlog file in the auth or account phase, so the inactivity of the user can't be determined. shrug, we tried ๐คท
๐ EXAMPLES ๐
drop this line into /etc/pam.d/login to display the last login time of a user:
session required pam_lastlog.so nowtmp
and if you wanna reject a user when they haven't logged in during the previous 50 days, use this line:
auth required pam_lastlog.so inactive=50
slay. copy, paste, done. โจ
๐ FILES ๐
/var/log/lastlogโ the lastlog logging file. this is where the receipts live ๐งพ
๐ฆ SEE ALSO ๐ฆ
limits.conf(5), pam.conf(5), pam.d(5), pam(7)
go read those too, bestie, the lore is deep ๐
๐ AUTHOR ๐
pam_lastlog was written by Andrew G. Morgan <morgan@kernel.org>.
inactive account lock out added by Tomรกลก Mrรกz <tm@t8m.info>.
and that's the whole page, no notes ๐
this was Linux-PAM Manual, version dated 09/03/2021 โ thanks for coming to my ted talk, mwah ๐ซถโจ
๐ฆ where this page comes from
- debian bookworm: libpam-modules 1.5.2-6+deb12u2 ยท BSD-3-Clause OR GPL
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms