[精讚] [會員登入]
5899

[Linux] 刪除last/lastb登出入記錄

linux shell的登出入記錄

分享此文連結 //n.sfs.tw/10382

分享連結 [Linux] 刪除last/lastb登出入記錄@新精讚
(文章歡迎轉載,務必尊重版權註明連結來源)
2019-10-23 11:36:32 最後編修
2016-12-06 10:27:59 By 張○○
 

自動目錄

查看

查看登出入記錄
$ last

axer     pts/0        211-75-194-241.h Sat Apr 18 14:19 - 15:22  (01:03)   

更詳細的登出入記錄包含失敗
# lastb

root     ssh:notty    218.86.88.31     Fri Dec  2 17:35 - 17:35  (00:00)   

登出入的時間
$ last -F

axer     pts/0        125-227-204-23.h Thu Apr 16 13:55:22 2015 - Thu Apr 16 15:45:40 2015  (01:50) 

限定使用者'username'
$ last username

限定筆數
$ last -n 5

查看帳戶的登入情況

...
axer             pts/3    120.109.248.230  二 12月  6 10:00:17 +0800 2016
mailnull                                   **從未登入過**
...

刪除

last資料儲存在/var/log/wtmp;lastb資料儲存在/var/log/btmp;lastlog資料儲存在/var/log/lastlog

只要把這兩個檔清空即可

刪除 last 記錄
# > /var/log/wtmp

刪除 lastb 記錄
# > /var/log/wtmp

刪除 lastlog 記錄
# > /var/log/lastlog

參考資料

[1] https://www.cyberciti.biz/faq/howto-display-clear-last-login-information/

 

END

你可能感興趣的文章

[Centos7] 安裝 semanage (selinux工具程式) 安裝selinux的工具程式 semanage

SELinux 常用指令和檔案 在Redhat系列中,Centos5以後加入了selinux,他並沒有這麼可怕,不必每次看到Selinux ,就想把他

[Rocky9] 負載平衡器Haproxy安裝及設定 負載平衡器Haproxy安裝及設定,這次的範例是透過本機的一個埠背後連到數台資料庫伺服器。

Linux ext3 系統下刪除檔案救回全記錄 今天一個不小心,下了 rm 的指令,從此奮戰一個下午,終於把檔案救回來,以下是全記錄...

[Centos7] selinux 修改網頁連線的埠號 想把網頁改到非標準的80埠,在selinux上要如何修改?

[Rocky Linux] 安裝gitlab gitlab+docker compose+ nginx 安裝Gitlab並結合nginx當網頁伺服器

隨機好文

Linux shell 的date表示法 linux下SHELL中的date表示法

世紀帝國征服者新版本--被遺忘的帝國 世紀帝國征服者新版本--被遺忘的帝國 世紀二代的征服者是精典遊戲中的精典,aofe更好玩...

[AS3] 我做的唯一一個Flash As3遊戲UFO INVADSION [AS3] 我做的唯一一個Flash As3遊戲,是第一個也是最後一個,後來就沒再寫as3,不過as3還滿好玩的。

APACHE的記錄檔格式 LogFormat 語法 在APACHE中有定義一些記錄的語法模版 在 /etc/httpd/conf/httpd.conf 中: LogForm

[NetBeans] 使用git複製別人的專案 NetBeans使用git複製別人的專案及版本控制