1LASTLOG(8)                System Management Commands                LASTLOG(8)
2
3
4

NAME

6       lastlog - reports the most recent login of all users or of a given user
7

SYNOPSIS

9       lastlog [options]
10

DESCRIPTION

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

OPTIONS

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. Only absolute paths are
33           supported.
34
35       -S, --set
36           Set lastlog record of a user to the current time. This option can
37           be used only together with -u (--user)).
38
39       -t, --time DAYS
40           Print the lastlog records more recent than DAYS.
41
42       -u, --user LOGIN|RANGE
43           Print the lastlog record of the specified user(s).
44
45           The users can be specified by a login name, a numerical user ID, or
46           a RANGE of users. This RANGE of users can be specified with a min
47           and max values (UID_MIN-UID_MAX), a max value (-UID_MAX), or a min
48           value (UID_MIN-).
49
50       If the user has never logged in the message ** Never logged in** will
51       be displayed instead of the port and time.
52
53       Only the entries for the current users of the system will be displayed.
54       Other entries may exist for users that were deleted previously.
55

NOTE

57       The lastlog file is a database which contains info on the last login of
58       each user. You should not rotate it. It is a sparse file, so its size
59       on the disk is usually much smaller than the one shown by "ls -l"
60       (which can indicate a really big file if you have in passwd users with
61       a high UID). You can display its real size with "ls -s".
62

CONFIGURATION

64       The following configuration variables in /etc/login.defs change the
65       behavior of this tool:
66
67       LASTLOG_UID_MAX (number)
68           Highest user ID number for which the lastlog entries should be
69           updated. As higher user IDs are usually tracked by remote user
70           identity and authentication services there is no need to create a
71           huge sparse lastlog file for them.
72
73           No LASTLOG_UID_MAX option present in the configuration means that
74           there is no user ID limit for writing lastlog entries.
75

FILES

77       /var/log/lastlog
78           Database times of previous user logins.
79

CAVEATS

81       Large gaps in UID numbers will cause the lastlog program to run longer
82       with no output to the screen (i.e. if in lastlog database there is no
83       entries for users with UID between 170 and 800 lastlog will appear to
84       hang as it processes entries with UIDs 171-799).
85
86       Having high UIDs can create problems when handling the <term>
87       /var/log/lastlog</term> with external tools. Although the actual file
88       is sparse and does not use too much space, certain applications are not
89       designed to identify sparse files by default and may require a specific
90       option to handle them.
91
92
93
94shadow-utils 4.13                 03/06/2023                        LASTLOG(8)
Impressum