首页 > 系统教程 > LINUX > 正文

linux显示失败登录记录是什么-lastb命令使用与实例

P粉390130307
发布: 2025-08-04 08:40:02
原创
661人浏览过

linux显示失败登录记录是什么-lastb命令使用与实例

Linux lastb命令说明

在 Linux 系统中,lastb 是一个用于查看用户登录失败记录的实用工具

当直接运行 lastb 命令时,默认会读取系统日志文件 /var/log/btmp,并列出所有尝试登录但失败的用户信息。

命令格式

<pre class="brush:php;toolbar:false;">lastb [-adRx][-f ][-n ][用户名...][终端编号...]
登录后复制

常用选项

options:

  • -R 忽略主机列的输出
  • -a 在最后列显示用户的登录来源(主机名或IP)
  • -d 将IP地址解析为主机名显示。
  • -f 指定要读取的日志文件。
  • -n或- 限制输出的行数。
  • -R 不显示远程主机名或IP地址。
  • -x 显示系统的重启、关机及运行级别变化信息。

username:

Symanto Text Insights
Symanto Text Insights

基于心理语言学分析的数据分析和用户洞察

Symanto Text Insights 84
查看详情 Symanto Text Insights
  • username:仅显示特定用户 username 的失败登录记录。

tty:

  • tty 指定特定的终端设备进行查询。例如:last 0 等同于 last tty0。

使用示例

查看所有失败的登录尝试:

<pre class="brush:php;toolbar:false;"># lastb 
...
zgg      ssh:notty    143.198.176.57   Thu Apr  7 11:27 - 11:27  (00:00)
zgg      ssh:notty    143.198.176.57   Thu Apr  7 11:27 - 11:27  (00:00)
zf       ssh:notty    143.198.176.57   Thu Apr  7 11:27 - 11:27  (00:00)
za       ssh:notty    143.198.176.57   Thu Apr  7 11:27 - 11:27  (00:00)
zeng     ssh:notty    143.198.176.57   Thu Apr  7 11:27 - 11:27  (00:00)
zf       ssh:notty    143.198.176.57   Thu Apr  7 11:27 - 11:27  (00:00)
zette    ssh:notty    143.198.176.57   Thu Apr  7 11:27 - 11:27  (00:00)
z310     ssh:notty    143.198.176.57   Thu Apr  7 11:27 - 11:27  (00:00)
<p>btmp begins Fri Apr  1 07:38:45 2022
登录后复制

仅显示前5条失败登录记录:

<pre class="brush:php;toolbar:false;"># lastb -n 5
mos      ssh:notty    194.31.98.204    Thu Apr 28 16:52 - 16:52  (00:00)
user     ssh:notty    194.31.98.204    Thu Apr 28 16:52 - 16:52  (00:00)
user     ssh:notty    194.31.98.204    Thu Apr 28 16:52 - 16:52  (00:00)
user     ssh:notty    194.31.98.204    Thu Apr 28 16:52 - 16:52  (00:00)
user     ssh:notty    194.31.98.204    Thu Apr 28 16:52 - 16:52  (00:00)</p><p>btmp begins Fri Apr  1 07:38:45 2022
登录后复制

以上就是linux显示失败登录记录是什么-lastb命令使用与实例的详细内容,更多请关注php中文网其它相关文章!

相关标签:
最佳 Windows 性能的顶级免费优化软件
最佳 Windows 性能的顶级免费优化软件

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号