爱有站长链

CentOS系统清除用户登录记录和命令历史方法


文章编号:31 / 更新时间:2022-12-29 / 浏览:
清除登陆系统成功的记录
[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 //查询导入结果
example 
[root@localhost root]# vi /root/history
[root@localhost root]# history -c
[root@localhost root]# history -r /root/history.txt
[root@localhost root]# history
[root@localhost root]# echo > /var/log/wtmp
[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]# history

相关标签: CentOS系统历史记录

本文地址: https://aiyouzz.com/article/31.html

上一篇:宝塔7.4.7LINUX企业永久付费破解版...
下一篇:CentOS系统添加IP或添加多个IP的方法教程...

发表评论

温馨提示

做上本站友情链接,在您站上点击一次,即可自动收录并自动排在本站第一位!
<a href="https://aiyouzz.com/" target="_blank">爱有站长链</a>