1LASTLOG(8) System Management Commands LASTLOG(8)
2
3
4
6 lastlog - reports the most recent login of all users or of a given user
7
9 lastlog [options]
10
12 lastlog formats and prints the contents of the last login log
13 /var/log/lastlog file. The login-name, port, and last login time will
14 be printed. The default (no flags) causes lastlog entries to be
15 printed, sorted by their order in /etc/passwd.
16
18 The options which apply to the lastlog command are:
19
20 -b, --before DAYS
21 Print only lastlog records older than DAYS.
22
23 -C, --clear
24 Clear lastlog record of a user. This option can be used only
25 together with -u (--user)).
26
27 -h, --help
28 Display help message and exit.
29
30 -R, --root CHROOT_DIR
31 Apply changes in the CHROOT_DIR directory and use the configuration
32 files from the CHROOT_DIR directory.
33
34 -S, --set
35 Set lastlog record of a user to the current time. This option can
36 be used only together with -u (--user)).
37
38 -t, --time DAYS
39 Print the lastlog records more recent than DAYS.
40
41 -u, --user LOGIN|RANGE
42 Print the lastlog record of the specified user(s).
43
44 The users can be specified by a login name, a numerical user ID, or
45 a RANGE of users. This RANGE of users can be specified with a min
46 and max values (UID_MIN-UID_MAX), a max value (-UID_MAX), or a min
47 value (UID_MIN-).
48
49 If the user has never logged in the message ** Never logged in** will
50 be displayed instead of the port and time.
51
52 Only the entries for the current users of the system will be displayed.
53 Other entries may exist for users that were deleted previously.
54
56 The lastlog file is a database which contains info on the last login of
57 each user. You should not rotate it. It is a sparse file, so its size
58 on the disk is usually much smaller than the one shown by "ls -l"
59 (which can indicate a really big file if you have in passwd users with
60 a high UID). You can display its real size with "ls -s".
61
63 The following configuration variables in /etc/login.defs change the
64 behavior of this tool:
65
66 LASTLOG_UID_MAX (number)
67 Highest user ID number for which the lastlog entries should be
68 updated. As higher user IDs are usually tracked by remote user
69 identity and authentication services there is no need to create a
70 huge sparse lastlog file for them.
71
72 No LASTLOG_UID_MAX option present in the configuration means that
73 there is no user ID limit for writing lastlog entries.
74
76 /var/log/lastlog
77 Database times of previous user logins.
78
80 Large gaps in UID numbers will cause the lastlog program to run longer
81 with no output to the screen (i.e. if in lastlog database there is no
82 entries for users with UID between 170 and 800 lastlog will appear to
83 hang as it processes entries with UIDs 171-799).
84
85
86
87shadow-utils 4.8.1 11/16/2020 LASTLOG(8)