Centos中清除登入記錄與記錄的例子

來源:互聯網
上載者:User

清除登陸系統成功的記錄

[root@localhost root]# echo > /var/log/wtmp //此檔案預設開啟時亂碼,可查到ip等資訊
[root@localhost root]# last //此時即查不到使用者登入資訊

清除登陸系統失敗的記錄

[root@localhost root]# echo > /var/log/btmp //此檔案預設開啟時亂碼,可查到登陸失敗資訊
[root@localhost root]# lastb //查不到登陸失敗資訊

清除曆史執行命令

[root@localhost root]# history -c //清空曆史執行命令
[root@localhost root]# echo > ./.bash_history //或清空使用者目錄下的這個檔案即可

匯入空記錄

[root@localhost root]# vi /root/history //建立記錄檔案
[root@localhost root]# history -c //清除記錄
[root@localhost root]# history -r /root/history.txt //匯入記錄
[root@localhost root]# history //查詢匯入結果

執行個體


清除登陸系統成功的記錄,也就是last命令看到的記錄

此檔案預設開啟時亂碼的,裡面可以看到ip等等資訊

echo >/var/log/wtmp
last

此時即看不到使用者登入資訊

清除登陸系統失敗的記錄,也就是lastb命令看到的記錄
此檔案預設開啟時亂碼的

echo > /var/log/btmp
lastb

此時就沒有結果輸出了


清除曆史執行命令

history -c

或者,清空使用者目錄下的這個檔案即可

echo >~/.bash_history

補充

[root@localhost root]# echo > /var/log/wtmp 此檔案預設開啟時亂碼的,裡面可以看到ip等等資訊

[root@localhost root]# echo >/var/log/wtmp

[root@localhost root]# last

此時即看不到使用者登入資訊

清除登陸系統失敗的記錄,也就是lastb命令看到的記錄

[root@localhost root]# echo > /var/log/btmp 此檔案預設開啟時亂碼的

[root@localhost root]# echo > /var/log/btmp

[root@localhost root]# lastb

此時就沒有結果輸出了

清除曆史執行命令

[root@localhost root]# history -c

或者,清空使用者目錄下的這個檔案即可

[root@localhost root]# echo > ./.bash_history

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.