linux 查询登录失败命令,lastb命令 – 列出登入系统失败的用户

lastb命令用于显示用户错误的登录列表,此指令可以发现系统的登录异常。

单独执行lastb命令,它会读取位于/var/log目录下,名称为btmp的文件,并把该文件内容记录的登入失败的用户名单,全部显示出来。

语法格式:lastb [参数]

常用参数:

-a把从何处登入系统的主机名称或ip地址显示在最后一行

-d将IP地址转换成主机名称

-f指定记录文件

-n设置列出名单的显示列数

-R不显示登入系统的主机名称或IP地址

-x显示系统关机,重新开机,以及执行等级的改变等信息

参考实例

列出登入失败的用户记录:

[root@linuxcool ~]# lastb

root ssh:notty 192.168.3.8 Mon Apr 29 14:25 - 14:25 (00:00)

root ssh:notty 192.168.3.8 Mon Apr 29 14:25 - 14:25 (00:00)

btmp begins Mon Apr 29 14:25:16 2019

使用-a参数把IP显示在最后列:

[root@linuxcool ~]# lastb -a

root ssh:notty Mon Apr 29 14:25 - 14:25 (00:00) 192.168.3.8

root ssh:notty Mon Apr 29 14:25 - 14:25 (00:00) 192.168.3.8

btmp begins Mon Apr 29 14:25:16 2019

使用-R参数不显示主机名和IP信息:

[root@linuxcool ~]# lastb -R

root ssh:notty Mon Apr 29 14:43 - 14:43 (00:00)

root ssh:notty Mon Apr 29 14:25 - 14:25 (00:00)

btmp begins Mon Apr 29 14:25:16 2019

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值