PAM\_LASTLOG2(8) System Administration PAM\_LASTLOG2(8)

# [NAME](#NAME)

pam\_lastlog2 - PAM module to display date of last login

# [SYNOPSIS](#SYNOPSIS)

**pam\_lastlog2.so** \[debug] \[silent] \[silent\_if=&lt;services&gt;] \[database=&lt;file&gt;]

# [DESCRIPTION](#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.

# [OPTIONS](#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=&lt;services&gt;**

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=&lt;file&gt;**

Use **file** instead of /var/lib/lastlog/lastlog2.db.

# [MODULE TYPES PROVIDED](#MODULE_TYPES_PROVIDED)

The **session** module type is provided for displaying the information about the last login and updating the lastlog file.

# [RETURN VALUES](#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.

# [EXAMPLES](#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.

# [AUTHOR](#AUTHOR)

**pam\_lastlog2** was written by *Thorsten Kukuk* &lt;kukuk@suse.com&gt;.

# [SEE ALSO](#SEE_ALSO)

[**liblastlog2**(3)](/man/os/util-linux/liblastlog2.3), [**pam.conf**(5)](/man/os/util-linux/pam.conf.5), [**pam.d**(5)](/man/os/util-linux/pam.d.5), [**pam**(8)](/man/os/util-linux/pam.8)

# [REPORTING BUGS](#REPORTING_BUGS)

For bug reports, use the *issue tracker* &lt;https://github.com/util-linux/util-linux/issues&gt;.

# [AVAILABILITY](#AVAILABILITY)

The **pam\_lastlog2** library is part of the util-linux package since version 2.40. It can be downloaded from *Linux Kernel Archive* &lt;https://www.kernel.org/pub/linux/utils/util-linux/&gt;.

2026-09-25 util-linux 2.42.4

---

Document: pam_lastlog2(8) from util-linux 2.42.4-r0 (Chainguard OS)
