首页IT科技last system reboot(lastb命令 – 列出登入系统失败的用户)

last system reboot(lastb命令 – 列出登入系统失败的用户)

时间2025-05-05 22:48:34分类IT科技浏览4563
导读: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
声明:本站所有文章                   ,如无特殊说明或标注            ,均为本站原创发布       。任何个人或组织   ,在未征得本站同意时                   ,禁止复制            、盗用                   、采集      、发布本站内容到任何网站         、书籍等各类媒体平台         。如若本站内容侵犯了原著者的合法权益               ,可联系我们进行处理                  。

创心域SEO版权声明:以上内容作者已申请原创保护,未经允许不得转载,侵权必究!授权事宜、对本内容有异议或投诉,敬请联系网站管理员,我们将尽快回复您,谢谢合作!

展开全文READ MORE
c++中long怎么用(C++11:longlong超长整型和nullptr初始化空指针)