lastlog文件在每次有用户登录时被查询.可以使用lastlog命令检查某特定用户上次登录的时间,并格式化输出上次登录日志 /var/log/lastlog
的内容.它根据UID排序显示登录名、端口号(tty)和上次登录时间.如果一个用户从未登录过,lastlog显示**Never logged**.注意需要以root身份运行该命令.运行该命令如下所示:
$ lastlog
用户名 最后登陆时间
root **从未登录过**
bin **从未登录过**
daemon **从未登录过**
adm **从未登录过**
lp **从未登录过**
sync **从未登录过**
shutdown **从未登录过**
halt **从未登录过**
mail **从未登录过**
news **从未登录过**
uucp **从未登录过**
operator **从未登录过**
games **从未登录过**
gopher **从未登录过**
ftp **从未登录过**
nobody **从未登录过**
rpm **从未登录过**
dbus **从未登录过**
avahi **从未登录过**
mailnull **从未登录过**
smmsp **从未登录过**
nscd **从未登录过**
vcsa **从未登录过**
haldaemon **从未登录过**
rpc **从未登录过**
rpcuser **从未登录过**
sshd **从未登录过**
pcap **从未登录过**
ntp **从未登录过**
gdm **从未登录过**
apache **从未登录过**
distcache **从未登录过**
postgres **从未登录过**
mysql **从未登录过**
dovecot **从未登录过**
webalizer **从未登录过**
squid **从未登录过**
named **从未登录过**
xfs **从未登录过**
sabayon **从未登录过**
postfix **从未登录过**
amanda **从未登录过**
cyrus **从未登录过**
mailman **从未登录过**
radiusd **从未登录过**
exim **从未登录过**
privoxy **从未登录过**
quagga **从未登录过**
radvd **从未登录过**
ldap **从未登录过**
tomcat **从未登录过**
pegasus **从未登录过**
liyang **从未登录过**
google **从未登录过**