/var/log/btmp ( lastb命令默认读取的日志)存储有关登录尝试失败的信息。我正在查看一个文件片段,看看我所理解的登录时间为几分钟的内容:
[#]> last -f /var/log/btmp.1 -10
test ssh:notty 210.212.249.228 Tue Oct 1 06:04 gone - no logout
current ssh:notty 115.133.236.49 Tue Oct 1 05:59 - 06:04 (00:05)
dudley ssh:notty host208.sub-63-4 Tue Oct 1 05:48 - 05:59 (00:10)
www ssh:notty net-5-88-155-130 Tue Oct 1 05:13 - 05:48 (00:34)
admin ssh:notty h106.205.186.173 Tue Oct 1 04:38 - 05:13 (00:35)
postmast ssh:notty 138.197.72.48 Tue Oct 1 04:27 - 04:38 (00:11)
ethos ssh:notty 45.55.157.147 Tue Oct 1 03:53 - 04:27 (00:33)
usuario ssh:notty v133-130-107-88. Tue Oct 1 03:35 - 03:53 (00:17)
ftp ssh:notty 36.66.156.125 Tue Oct 1 03:23 - 03:35 (00:12)
oracle5 ssh:notty 112.140.185.64 Tue Oct 1 03:02 - 03:23 (00:20)如果这个日志只包含失败的登录,用户如何登录几分钟?
发布于 2019-11-11 17:29:15
除了lastb之外,还有专门用于失败登录的last。
下面是在同一个系统中显示的它们之间的区别:
last:
% sudo last -f /var/log/btmp -F games
games ssh:notty ::1 Tue Nov 12 00:02:08 2019 - Tue Nov 12 00:10:02 2019 (00:07)
games ssh:notty ::1 Tue Nov 12 00:01:58 2019 - Tue Nov 12 00:02:08 2019 (00:00)lastb:
% sudo lastb -F games
games ssh:notty ::1 Tue Nov 12 00:02:08 2019 - Tue Nov 12 00:02:08 2019 (00:00)
games ssh:notty ::1 Tue Nov 12 00:01:58 2019 - Tue Nov 12 00:01:58 2019 (00:00)您可能已经注意到,用您自己的例子来说,有些东西并不适用于last -- last告诉您,最后一个用户没有注销:"gone - no logout“。另一个要注意的奇怪的事情是在登录和登录时间中链接:oracle5显示为在03:23上注销,03:23显示为ftp登录的时间戳。
因此,简单的回答是:last不是为处理失败的登录而设计的。使用lastb代替。
https://unix.stackexchange.com/questions/549417
复制相似问题