列出登入系统失败的用户相关信息。lastb命令 用于显示用户错误的登录列表,此指令可以发现系统的登录异常。单独执行lastb命令,它会读取位于
/var/log
目录下,名称为btmp的文件,并把该文件内容记录的登入失败的用户名单,全部显示出来。
lastb [选项] [参数]
> lastb | head
root ssh:notty 120.132.112.75 Sun Apr 11 22:18 - 22:18 (00:00)
root ssh:notty 185.36.81.44 Sun Apr 11 22:18 - 22:18 (00:00)
root ssh:notty 101.89.138.113 Sun Apr 11 22:18 - 22:18 (00:00)
admin1 ssh:notty 123.21.35.183 Sun Apr 11 22:18 - 22:18 (00:00)
admin1 ssh:notty 123.21.35.183 Sun Apr 11 22:17 - 22:17 (00:00)
adria ssh:notty 132.232.32.203 Sun Apr 11 22:17 - 22:17 (00:00)
adria ssh:notty 132.232.32.203 Sun Apr 11 22:17 - 22:17 (00:00)
root ssh:notty 115.79.35.110 Sun Apr 11 22:17 - 22:17 (00:00)
user ssh:notty 103.248.31.50 Sun Apr 11 22:17 - 22:17 (00:00)
user ssh:notty 103.248.31.50 Sun Apr 11 22:17 - 22:17 (00:00)
lastb指令,它会读取位于/var/log/btmp的文件,并把该文件内容记录的登入系统失败的用户名单,全部显示出来。btmp是二进制文件,所以用
last -f /var/log/btmp
结果一样。
> lastb root | head
root ssh:notty 123.21.35.183 Sun Apr 11 22:25 - 22:25 (00:00)
root ssh:notty 123.21.35.183 Sun Apr 11 22:24 - 22:24 (00:00)
root ssh:notty 123.21.35.183 Sun Apr 11 22:24 - 22:24 (00:00)
root ssh:notty 120.132.112.75 Sun Apr 11 22:24 - 22:24 (00:00)
root ssh:notty 81.69.251.186 Sun Apr 11 22:23 - 22:23 (00:00)
root ssh:notty 123.21.35.183 Sun Apr 11 22:23 - 22:23 (00:00)
root ssh:notty 123.21.35.183 Sun Apr 11 22:22 - 22:22 (00:00)
root ssh:notty 81.69.251.186 Sun Apr 11 22:21 - 22:21 (00:00)
root ssh:notty 120.132.112.75 Sun Apr 11 22:21 - 22:21 (00:00)
root ssh:notty 120.132.112.75 Sun Apr 11 22:18 - 22:18 (00:00)
> echo > /var/log/btmp
原文链接:https://rumenz.com/rumenbiji/linux-lastb.html
微信公众号:入门小站
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。