首页 > 系统 > Linux > 正文

Linux系统如何清除用户登录记录

2020-10-14 22:41:19
字体:
来源:转载
供稿:网友

   清除登陆系统成功的记录
   
    [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
   
    1.vi /root/history #新建记录文件
   
    2.history -c #清除记录
   
    3.history -r /root/history.txt #导入记录
   
    4.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
   
    1 echo > /var/log/wtmp
   
    2 last
   
    3 echo > /var/log/btmp
   
    4 lastb
   
    5 history -c
   
    6 echo > ./.bash_history
   
    7 history


(责任编辑:VEVB)

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表