ssh登录后删除记录

Posted by Remilia Scarlet on March 23, 2021

登录ssh后删除各种日志

删除journalctl日志

journalctl --rotate
journalctl --vacuum-time=1s

删除wtmp日志

[ -e /var/log/wtmp ] && > /var/log/wtmp

删除btmp日志

[ -e /var/log/btmp ] && > /var/log/btmp

删除lastlog日志

[ -e /var/log/lastlog ] && > /var/log/lastlog

删除auth.log日志

sed -i '/xxx.xxx.xxx.xxx/d' /var/log/auth.log

清除bash记录

history -r

参考链接

https://my.oschina.net/u/4301418/blog/3343026 https://unix.stackexchange.com/questions/139513/how-to-clear-journalctl


| 访问量: