pam_lastlog2 - PAM module to display date of last login
Contents
Availability
The pam_lastlog2 library is part of the util-linux package since version 2.40. It can be downloaded from
Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>.
util-linux 2.41 2025-02-26 PAM_LASTLOG2(8)
Description
pam_lastlog2 is a PAM module to display a line of information about the last login of the user. The
module uses the /var/lib/lastlog/lastlog2.db database file to store all information.
Compared to pam_lastlog this PAM module is Y2038 safe and uses sqlite3 to store the information.
Examples
Add the following line to e.g. /etc/pam.d/login to display the last login time of a user:
session optional pam_lastlog2.so silent_if=gdm,gdm-password
It is up to the administrator to decide if the user can login (optional/required) when pam_lastlog2 has
returned an error.
Module Types Provided
The session module type is provided for displaying the information about the last login and updating the
lastlog file.
Name
pam_lastlog2 - PAM module to display date of last login
Options
debug
Print debug information.
silent
Avoid all messages except errors and donβt inform the user about any previous login, only update the
/var/lib/lastlog/lastlog2.db database.
silent_if=<services>
The argument services is a comma separated list of PAM services. If a service is listed here, the
last login message will not be shown.
database=<file>
Use file instead of /var/lib/lastlog/lastlog2.db.
Reporting Bugs
For bug reports, use the issue tracker <https://github.com/util-linux/util-linux/issues>.
Return Values
PAM_SUCCESS
Everything was successful.
PAM_SERVICE_ERR
Internal service module error. This includes error reading from or writing to the database.
PAM_USER_UNKNOWN
User not known.
PAM_IGNORE
Returned by service types which do nothing.
See Also
liblastlog2(3), pam.conf(5), pam.d(5), pam(8)
Synopsis
pam_lastlog2.so [debug] [silent] [silent_if=<services>] [database=<file>]
