配色: 字号:
Linux清除用户登录记录和命令历史方法
2014-07-14 | 阅:  转:  |  分享 
  
Linux清除用户登录记录和命令历史方法

2012-07-2009:22:49我来说两句收藏我要投稿



清除登陆系统成功的记录

[root@localhostroot]#echo>/var/log/wtmp#此文件默认打开时乱码,可查到ip等信息

[root@localhostroot]#last#此时即查不到用户登录信息



清除登陆系统失败的记录

[root@localhostroot]#echo>/var/log/btmp#此文件默认打开时乱码,可查到登陆失败信息

[root@localhostroot]#lastb#查不到登陆失败信息



清除历史执行命令

[root@localhostroot]#history-c

或者,清空用户目录下的这个文件即可

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



1.vi/root/history#新建记录文件

2.history-c#清除记录

3.history-r/root/history.txt#导入记录

4.history#查询导入结果

www.2cto.com

example

[root@localhostroot]#vi/root/history

[root@localhostroot]#history-c

[root@localhostroot]#history-r/root/history.txt

[root@localhostroot]#history

1echo>/var/log/wtmp

2last

3echo>/var/log/btmp

4lastb

5history-c

6echo>./.bash_history

7history

献花(0)
+1
(本文系忧郁_小刚首藏)