清理登录Linux登录的一些记录

linux_collection_mini
linux_collection_mini

清除成功登录的记录
[root@webrss.org root]# echo > /var/log/wtmp //此文件默认打开时乱码,可查到ip等信息
[root@webrss.org root]# last //此时即查不到用户登录信息

清除登录失败的记录
[root@webrss.org root]# echo > /var/log/btmp //此文件默认打开时乱码,可查到登陆失败信息
[root@webrss.org root]# lastb //查不到登陆失败信息

清除命令历史记录
[root@webrss.org root]# history -c //清空历史执行命令
[root@webrss.org root]# echo > ./.bash_history //或清空用户目录下的这个文件即可

导入空历史记录
[root@webrss.org root]# vi /root/history //新建记录文件
[root@webrss.org root]# history -c //清除记录
[root@webrss.org root]# history -r /root/history.txt //导入记录
[root@webrss.org root]# history //查询导入结果

下面是几个简单的例子方便参考
[root@webrss.org root]# vi /root/history
[root@webrss.org root]# history -c
[root@webrss.org root]# history -r /root/history.txt
[root@webrss.org root]# history
[root@webrss.org root]# echo > /var/log/wtmp
[root@webrss.org root]# last
[root@webrss.org root]# echo > /var/log/btmp
[root@webrss.org root]# lastb
[root@webrss.org root]# history -c
[root@webrss.org root]# echo > ./.bash_history
[root@webrss.org root]# history

About 歇歇脚|Java|Linux 1036 Articles
歇歇脚元老