/var/log/wtmp文件的作用
https://blog.51cto.com/oldyunwei/1658778
/var/log/wtmp是一个二进制文件,记录每个用户的登录次数和持续时间等信息
查看方法:
用last命令输出当中内容:
[root@mail log]# last
root pts/0 192.168.80.117 Fri Jun 5 14:48 still logged in
root tty1 Fri Jun 5 14:48 still logged in
reboot system boot 2.6.32-431.el6.x Fri Jun 5 14:47 - 15:50 (01:02)
root pts/3 maweidong Thu Jun 4 22:03 - down (00:25)
root pts/2 maweidong Thu Jun 4 20:12 - down (02:16)
root pts/1 maweidong Thu Jun 4 19:56 - down (02:32)
root pts/0 maweidong Thu Jun 4 19:25 - 22:07 (02:41)
或者用last -f /var/log/wtmp
[root@mail log]# last -f wtmp
root pts/0 192.168.80.117 Fri Jun 5 14:48 still logged in
root tty1 Fri Jun 5 14:48 still logged in
reboot system boot 2.6.32-431.el6.x Fri Jun 5 14:47 - 15:39 (00:51)
root pts/3 maweidong Thu Jun 4 22:03 - down (00:25)
root pts/2 maweidong Thu Jun 4 20:12 - down (02:16)
root pts/1 maweidong Thu Jun 4 19:56 - down (02:32)
root pts/0 maweidong Thu Jun 4 19:25 - 22:07 (02:41)
root tty1 Thu Jun 4 19:25 - down (03:04)
或
[root@mail log]# who -u wtmp
root tty1 2015-05-29 18:43 00:50 1019
root pts/0 2015-05-29 18:51 . 2438 (maweidong)
root pts/1 2015-05-29 20:35 ? 2613 (maweidong)
root tty1 2015-05-29 21:44 00:50 1112
root pts/0 2015-05-29 21:44 . 1216 (maweidong)
root tty1 2015-06-01 16:17 00:50 1097
root pts/0 2015-06-01 16:17 . 1204 (maweidong)