赞
踩
lastb命令用于显示用户错误的登录列表,此指令可以发现系统的登录异常。单独执行lastb命令,它会读取位于/var/log
目录下,名称为btmp的文件,并把该文件内容记录的登入失败的用户名单,全部显示出来。
lastb [选项] [参数]
lastb 与last命令类似,lastb命令查找、var/log/btmp 文件,此文件列出了所有登录系统失败的用户的信息
必要参数
-n 显示最近登录信息的行数
-t 根据登陆的时间显示指定用户的登录状态
-R 简略显示主机名区域
-a 在最后一列显示主机名称
-d 对于非本地登录的用户,将显示的IP地址转换为主机名
-i 类似于“-d” 的选项,将显示的主机名称转换为IP地址
-o 读取旧的类型的wtmp 文件
-x 显示系统登录等级
--help 显示帮助信息
--version 显示版本显示
4.1 列出登入失败的用户记录
[root@itcast ~]# lastb
root pts/1 Fri Aug 2 21:00 - 21:00 (00:00)
root pts/1 Thu Aug 1 21:27 - 21:27 (00:00)
btmp begins Thu Aug 1 21:27:11 2019
[root@itcast ~]#
lastb指令,它会读取位于**/var/log/btmp的文件,并把该文件内容记录的登入系统失败**的用户名单,全部显示出来。btmp是二进制文件,所以用 last -f /var/log/btmp 结果一样。
4.2 使用-a参数把IP显示在最后列
[root@itcast ~]# lastb -a
root pts/1 Fri Aug 2 21:00 - 21:00 (00:00)
root pts/1 Thu Aug 1 21:27 - 21:27 (00:00)
btmp begins Thu Aug 1 21:27:11 2019
[root@itcast ~]#
4.3 使用-R参数不显示主机名和IP信息
[root@itcast ~]# lastb -R
root pts/1 Fri Aug 2 21:00 - 21:00 (00:00)
root pts/1 Thu Aug 1 21:27 - 21:27 (00:00)
btmp begins Thu Aug 1 21:27:11 2019
[root@itcast ~]#
4.4 显示6条登录失败的信息
[root@itcast ~]# lastb -6
root pts/1 Fri Aug 2 21:00 - 21:00 (00:00)
root pts/1 Thu Aug 1 21:27 - 21:27 (00:00)
btmp begins Thu Aug 1 21:27:11 2019
[root@itcast ~]#
4.5 显示3条登录失败的信息
[root@itcast ~]# lastb -n 3
root pts/1 Fri Aug 2 21:00 - 21:00 (00:00)
root pts/1 Thu Aug 1 21:27 - 21:27 (00:00)
btmp begins Thu Aug 1 21:27:11 2019
[root@itcast ~]#
4.6 显示2条关于root用户登录失败的信息
[root@itcast ~]# lastb -n 2 root
root pts/1 Fri Aug 2 21:00 - 21:00 (00:00)
root pts/1 Thu Aug 1 21:27 - 21:27 (00:00)
btmp begins Thu Aug 1 21:27:11 2019
[root@itcast ~]#
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。