CHKLASTLOG(8)
π chklastlog β bestie edition π
okay so this is chklastlog, and it lives in section 8 of the System Manager's Manual (System Manager's Manual, the admin-y part of the manual, iykyk). it's a little forensics bestie that sniffs out sneaky deleted logins. let's get into it π΅οΈβοΈβ¨
β¨ NAME β¨
chklastlog β check the lastlog file for deleted entries, fr fr π
πΈ SYNOPSIS πΈ
chklastlog looks for users whose login has been erased from the lastlog database. that's it, that's the whole vibe check π
π¦ DESCRIPTION π¦
okay so here's the tea. chklastlog reads all the entries from /var/log/wtmp (which is, like, a whole database of info about logins and logouts, very main character of it) and then checks that every single user it finds in that file actually has an entry in /var/log/lastlog.
then it lists any users who have logins in wtmp but no lastlogin information. and bestieβ¦ that's a red flag π© because it may suggest the user account has been compromised and the attacker has tried to cover their tracks. like, not me deleting the receipts ππ
chklastlog needs to be able to read /var/log/wtmp and /var/log/lastlogin. the good news? normally these files are world-readable, so no special privileges are required. no sudo moment needed, we love that for us π«Ά
π FILES π
/var/log/wtmpβ database of logins and logouts. the whole social calendar, basically π/var/log/lastlogβ database which contains info on the last login of each user. the "last seen" feature but make it Unix π
π SEE ALSO π
wtmp(5), who(1), lastlog(8), last(1) β go read those too, they're iconic, no cap β
π LIMITATIONS π
okay, reality check time, and this part is important so listen up:
wtmpmay itself be incomplete, because not all programmes record their activity using utmp logging. seewtmp(8). so like, the data can be missing pieces before you even start π«chklastlogwill not detect missing entries if the user has logged in after the lastlog entry was deleted. so if they came back around, the evidence is justβ¦ gone. tragic π- this program was originally designed to run on SunOS 4.x systems. on other systems the output is undefined. so yeah, on anything else it's giving chaos, and we're not gonna pretend otherwise. consider yourself warned π¨
undefined output is not a vibe. don't build your whole incident response on it if you're not on SunOS 4.x, bestie.
mwah, that's the whole page π this little cutie comes from the System Manager's Manual and the version/date on the tin is Oct 23, 2021. stay safe out there, keep your logs, and never let anyone erase your lastlogin info ππ β¨
π¦ where this page comes from
- debian bookworm: chkrootkit 0.57-2+b9 Β· BSD-2-Clause
- debian trixie: chkrootkit 0.58b-5+b8 Β· BSD-2-Clause
- ubuntu jammy: chkrootkit 0.55-4 Β· BSD-2-Clause
- ubuntu noble: chkrootkit 0.58b-1 Β· BSD-2-Clause
- ubuntu questing: chkrootkit 0.58b-6
- ubuntu resolute: chkrootkit 0.58b-6build1 Β· BSD-2-Clause
- ubuntu stonking: chkrootkit 0.59-1 Β· BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms