Linux下清除用户登录记录和命令历史 图文实例

[title]清除登陆系统成功的记录[/title]
[[email protected] root]#?echo > /var/log/wtmp?//此文件默认打开时乱码,可查到ip等信息
[[email protected] root]#?last?//此时即查不到用户登录信息

[title]清除登陆系统失败的记录[/title]
[[email protected] root]#?echo > /var/log/btmp?//此文件默认打开时乱码,可查到登陆失败信息
[[email protected] root]#?lastb?//查不到登陆失败信息
[title]清除历史执行命令[/title]
[[email protected] root]#?history -c?//清空历史执行命令
[[email protected] root]#?echo > ./.bash_history?//或清空用户目录下的这个文件即可
[title]导入空历史记录[/title]
[[email protected] root]#?vi /root/history?//新建记录文件
[[email protected] root]#?history -c?//清除记录
[[email protected] root]#?history -r /root/history.txt?//导入记录
[[email protected] root]#?history?//查询导入结果
[title]示例: [/title]
[[email protected] root]#?vi /root/history
[[email protected] root]#?history -c
[[email protected] root]#?history -r /root/history.txt
[[email protected] root]#?history
[[email protected] root]#?echo > /var/log/wtmp
[[email protected] root]#?last
[[email protected] root]#?echo > /var/log/btmp
[[email protected] root]#?lastb
[[email protected] root]#?history -c
[[email protected] root]#?echo > ./.bash_history
[[email protected] root]#?history
厂家CPU内存硬盘流量价格购买链接
RamNode11GB25GB-SSD500GB/mUSD $5购买
Vultr11GB25GB-SSD1000GB/mUSD $5/m购买
DigitalOcean11GB25GB-SSD1000GB/mUSD $5/m购买
腾讯云Qcloud22GB50GB-SSD购买

已发布

分类

作者:

标签

评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注