📑 Table of Contents

lastlog is a program available on most Linux distributions. It formats and prints the contents of the last login log file, /var/log/lastlog (which is a usually a very sparse file), including the login name, port, and last login date and time. It is similar in functionality to the BSD program last, also included in Linux distributions; however, last parses a different binary database file (/var/log/wtmp and /var/log/btmp).

The file is updated by the pam_lastlog.so Pluggable Authentication Module.[1] The module has been deprecated since 2023, and is announced to be removed in future releases of the pam-linux framework, due to the data structures inherently being affected by the Year 2038 problem.[2]

Usage

edit

Lastlog prints its output in column format with login-name, port, and last-login-time of each and every user on the system mentioned in that order. The users are sorted by default according to the order in /etc/passwd However, it can also be used to modify the records kept in /var/log/lastlog.

$ lastlog
Username         Port     From             Latest
root                                       **Never logged in**
user            tty3                        Sun Jan 14 16:29:24 +0130 2019

References

edit
  1. ^ "linux-pam source code". Github. Retrieved 2025-04-21.
  2. ^ "linux-pam NEWS document". github. Retrieved 2025-04-21.
edit

📚 Artikel Terkait di Wikipedia

Utmp

utmpx: /var/run/utx.active (replaces utmp) /var/log/utx.lastlogin (replaces lastlog) /var/log/utx.log (replaces wtmp) Different commands allow users to consult

Host-based intrusion detection system comparison

"ChkRootkit". Ubuntu. Retrieved 2017-04-19. ChkRootkit in the Ubuntu Repositories lastlog, wtmp, utmp, wtmpx "RKHunter". Ubuntu. Retrieved 2017-04-19. RKHunter in

List of GNU packages

chuser, cppw, expiry, gpasswd, grpck, gshadow, hwclock, isosize, last, lastlog, login, lsage, lsgroup, lsuser, mkgroup, mkuser, nologin, passwd, pwck

Open Source Tripwire

$(SYSBIN); /etc/security -> +pug (recurse=-1); # ignore last log !/etc/security/lastlog; # logs SYSLOGS = +p-lum; /var/adm/messages -> $(SYSLOGS); /opt -> $(SYSBIN);