用户登录相关的日志

/var/log/wtmp 用于记录登录成功的用户的信息,是一个二进制文件,只能通过 last 命令来查看
/var/log/btmp 用于记录登录失败的用户的信息,是一个二进制文件,只能通过 lastb 命令来查看
/var/log/lastlog 用于记录用户的历史登录情况,是一个二进制文件,只能通过 lastlog 命令来查看
/var/run/utmp 用于记录当前登录的用户的信息,是一个二进制文件,只能通过 who 命令来查看

如下,分别表示登录的用户,登录的终端,登录的IP地址,登录的时间 - 持续到哪个时间 ( 登录的持续时间 )

[root@localhost ~]$ last
root     pts/0        14.23.168.10     Fri Dec 28 10:28   still logged in   
root     pts/2        14.23.168.10     Thu Dec 27 10:43 - 10:43  (00:00)    
root     pts/1        14.23.168.10     Mon Dec 24 09:26 - 10:21 (4+00:55)   
root     pts/0        14.23.168.10     Mon Dec 24 08:58 - 10:21 (4+01:23)   
root     pts/1        61.28.109.54     Sun Dec 23 16:22 - 16:50  (00:28)    
[root@localhost ~]$ lastb
root     ssh:notty    104.129.0.2      Thu Jan 24 16:17 - 16:17  (00:00)    
root     ssh:notty    104.129.0.2      Thu Jan 24 16:17 - 16:17  (00:00)    
root     ssh:notty    104.129.0.2      Thu Jan 24 16:17 - 16:17  (00:00)    
root     ssh:notty    104.129.0.2      Thu Jan 24 16:16 - 16:16  (00:00)    
root     ssh:notty    104.129.0.2      Thu Jan 24 16:16 - 16:16  (00:00)    
[root@localhost ~]$ who
root     pts/1        2019-02-12 11:13 (183.60.122.237)
root     pts/5        2019-02-12 11:29 (183.60.122.237)
root     pts/11       2019-02-12 11:28 (183.60.122.237)
[root@localhost ~]$ lastlog 
用户名           端口     来自             最后登陆时间
root            pts/1   192.168.119.1    四 2月 14 17:21:30 +0800 2019
bin                                      **从未登录过**
daemon                                   **从未登录过**
adm                                      **从未登录过**

    

   

原文地址:https://www.cnblogs.com/pzk7788/p/10189560.html