Linux lastb 命令用于列出登入系統(tǒng)失敗的用戶相關(guān)信息。
單獨執(zhí)行 lastb 指令,它會讀取位于 /var/log 目錄下,名稱為 btmp 的文件,并把該文件記錄登入失敗的用戶名,全部顯示出來。
lastb [-adRx][-f <記錄文件>][-n <顯示行數(shù)>][帳號名稱...][終端機編號...]
參數(shù)說明:
options:
username:
tty:
顯示屬于登錄失敗的用戶信息:
# 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) btmp begins Fri Apr 1 07:38:45 2022
顯示 5 行登錄失敗的用戶信息:
# 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) btmp begins Fri Apr 1 07:38:45 2022