| 1 |
'\" t |
| 2 |
.\" Title: pam_lastlog |
| 3 |
.\" Author: [see the "AUTHOR" section] |
| 4 |
.\" Generator: DocBook XSL Stylesheets v1.79.2 <http://docbook.sf.net/> |
| 5 |
.\" Date: 01/25/2026 |
| 6 |
.\" Manual: Linux-PAM Manual |
| 7 |
.\" Source: Linux-PAM |
| 8 |
.\" Language: English |
| 9 |
.\" |
| 10 |
.TH "PAM_LASTLOG" "8" "01/25/2026" "Linux\-PAM" "Linux\-PAM Manual" |
| 11 |
.\" ----------------------------------------------------------------- |
| 12 |
.\" * Define some portability stuff |
| 13 |
.\" ----------------------------------------------------------------- |
| 14 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 15 |
.\" http://bugs.debian.org/507673 |
| 16 |
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html |
| 17 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 18 |
.ie \n(.g .ds Aq \(aq |
| 19 |
.el .ds Aq ' |
| 20 |
.\" ----------------------------------------------------------------- |
| 21 |
.\" * set default formatting |
| 22 |
.\" ----------------------------------------------------------------- |
| 23 |
.\" disable hyphenation |
| 24 |
.nh |
| 25 |
.\" disable justification (adjust text to left margin only) |
| 26 |
.ad l |
| 27 |
.\" ----------------------------------------------------------------- |
| 28 |
.\" * MAIN CONTENT STARTS HERE * |
| 29 |
.\" ----------------------------------------------------------------- |
| 30 |
.SH "NAME" |
| 31 |
pam_lastlog \- PAM module to display date of last login and perform inactive account lock out |
| 32 |
.SH "SYNOPSIS" |
| 33 |
.HP \w'\fBpam_lastlog\&.so\fR\ 'u |
| 34 |
\fBpam_lastlog\&.so\fR [debug] [silent] [never] [nodate] [nohost] [noterm] [nowtmp] [noupdate] [showfailed] [inactive=<days>] [unlimited] |
| 35 |
.SH "DESCRIPTION" |
| 36 |
.PP |
| 37 |
pam_lastlog is a PAM module to display a line of information about the last login of the user\&. In addition, the module maintains the |
| 38 |
/var/log/lastlog |
| 39 |
file\&. |
| 40 |
.PP |
| 41 |
Some applications may perform this function themselves\&. In such cases, this module is not necessary\&. |
| 42 |
.PP |
| 43 |
The module checks |
| 44 |
\fBLASTLOG_UID_MAX\fR |
| 45 |
option in |
| 46 |
/etc/login\&.defs |
| 47 |
and does not update or display last login records for users with UID higher than its value\&. If the option is not present or its value is invalid, no user ID limit is applied\&. |
| 48 |
.PP |
| 49 |
If the module is called in the auth or account phase, the accounts that were not used recently enough will be disallowed to log in\&. The check is not performed for the root account so the root is never locked out\&. It is also not performed for users with UID higher than the |
| 50 |
\fBLASTLOG_UID_MAX\fR |
| 51 |
value\&. |
| 52 |
.SH "OPTIONS" |
| 53 |
.PP |
| 54 |
debug |
| 55 |
.RS 4 |
| 56 |
Print debug information\&. |
| 57 |
.RE |
| 58 |
.PP |
| 59 |
silent |
| 60 |
.RS 4 |
| 61 |
Don\*(Aqt inform the user about any previous login, just update the |
| 62 |
/var/log/lastlog |
| 63 |
file\&. This option does not affect display of bad login attempts\&. |
| 64 |
.RE |
| 65 |
.PP |
| 66 |
never |
| 67 |
.RS 4 |
| 68 |
If the |
| 69 |
/var/log/lastlog |
| 70 |
file does not contain any old entries for the user, indicate that the user has never previously logged in with a welcome message\&. |
| 71 |
.RE |
| 72 |
.PP |
| 73 |
nodate |
| 74 |
.RS 4 |
| 75 |
Don\*(Aqt display the date of the last login\&. |
| 76 |
.RE |
| 77 |
.PP |
| 78 |
noterm |
| 79 |
.RS 4 |
| 80 |
Don\*(Aqt display the terminal name on which the last login was attempted\&. |
| 81 |
.RE |
| 82 |
.PP |
| 83 |
nohost |
| 84 |
.RS 4 |
| 85 |
Don\*(Aqt indicate from which host the last login was attempted\&. |
| 86 |
.RE |
| 87 |
.PP |
| 88 |
nowtmp |
| 89 |
.RS 4 |
| 90 |
Don\*(Aqt update the wtmp entry\&. |
| 91 |
.RE |
| 92 |
.PP |
| 93 |
noupdate |
| 94 |
.RS 4 |
| 95 |
Don\*(Aqt update any file\&. |
| 96 |
.RE |
| 97 |
.PP |
| 98 |
showfailed |
| 99 |
.RS 4 |
| 100 |
Display number of failed login attempts and the date of the last failed attempt from btmp\&. The date is not displayed when |
| 101 |
\fBnodate\fR |
| 102 |
is specified\&. |
| 103 |
.RE |
| 104 |
.PP |
| 105 |
inactive=<days> |
| 106 |
.RS 4 |
| 107 |
This option is specific for the auth or account phase\&. It specifies the number of days after the last login of the user when the user will be locked out by the module\&. The default value is 90\&. |
| 108 |
.RE |
| 109 |
.PP |
| 110 |
unlimited |
| 111 |
.RS 4 |
| 112 |
If the |
| 113 |
\fIfsize\fR |
| 114 |
limit is set, this option can be used to override it, preventing failures on systems with large UID values that lead lastlog to become a huge sparse file\&. |
| 115 |
.RE |
| 116 |
.SH "MODULE TYPES PROVIDED" |
| 117 |
.PP |
| 118 |
The |
| 119 |
\fBauth\fR |
| 120 |
and |
| 121 |
\fBaccount\fR |
| 122 |
module type allows one to lock out users who did not login recently enough\&. The |
| 123 |
\fBsession\fR |
| 124 |
module type is provided for displaying the information about the last login and/or updating the lastlog and wtmp files\&. |
| 125 |
.SH "RETURN VALUES" |
| 126 |
.PP |
| 127 |
.PP |
| 128 |
PAM_SUCCESS |
| 129 |
.RS 4 |
| 130 |
Everything was successful\&. |
| 131 |
.RE |
| 132 |
.PP |
| 133 |
PAM_SERVICE_ERR |
| 134 |
.RS 4 |
| 135 |
Internal service module error\&. |
| 136 |
.RE |
| 137 |
.PP |
| 138 |
PAM_USER_UNKNOWN |
| 139 |
.RS 4 |
| 140 |
User not known\&. |
| 141 |
.RE |
| 142 |
.PP |
| 143 |
PAM_AUTH_ERR |
| 144 |
.RS 4 |
| 145 |
User locked out in the auth or account phase due to inactivity\&. |
| 146 |
.RE |
| 147 |
.PP |
| 148 |
PAM_IGNORE |
| 149 |
.RS 4 |
| 150 |
There was an error during reading the lastlog file in the auth or account phase and thus inactivity of the user cannot be determined\&. |
| 151 |
.RE |
| 152 |
.SH "EXAMPLES" |
| 153 |
.PP |
| 154 |
Add the following line to |
| 155 |
/etc/pam\&.d/login |
| 156 |
to display the last login time of a user: |
| 157 |
.sp |
| 158 |
.if n \{\ |
| 159 |
.RS 4 |
| 160 |
.\} |
| 161 |
.nf |
| 162 |
session required pam_lastlog\&.so nowtmp |
| 163 |
|
| 164 |
.fi |
| 165 |
.if n \{\ |
| 166 |
.RE |
| 167 |
.\} |
| 168 |
.PP |
| 169 |
To reject users if they did not login during the previous 50 days the following line can be used: |
| 170 |
.sp |
| 171 |
.if n \{\ |
| 172 |
.RS 4 |
| 173 |
.\} |
| 174 |
.nf |
| 175 |
auth required pam_lastlog\&.so inactive=50 |
| 176 |
|
| 177 |
.fi |
| 178 |
.if n \{\ |
| 179 |
.RE |
| 180 |
.\} |
| 181 |
.SH "FILES" |
| 182 |
.PP |
| 183 |
/var/log/lastlog |
| 184 |
.RS 4 |
| 185 |
Lastlog logging file |
| 186 |
.RE |
| 187 |
.SH "SEE ALSO" |
| 188 |
.PP |
| 189 |
\fBlimits.conf\fR(5), |
| 190 |
\fBpam.conf\fR(5), |
| 191 |
\fBpam.d\fR(5), |
| 192 |
\fBpam\fR(8) |
| 193 |
.SH "AUTHOR" |
| 194 |
.PP |
| 195 |
pam_lastlog was written by Andrew G\&. Morgan <morgan@kernel\&.org>\&. |
| 196 |
.PP |
| 197 |
Inactive account lock out added by Tomáš Mráz <tm@t8m\&.info>\&. |