国外VPS

清除Linux登录记录/历史命令

提醒:本文最后更新于2023-02-10 12:30,文中所关联的信息可能已发生改变,请知悉!

CentOS

cat /dev/null > /var/log/wtmp
cat /dev/null > /var/log/btmp
cat /dev/null > /var/log/lastlog
cat /dev/null > /var/log/secure
history -cw

Ubuntu/Debian

cat /dev/null > /var/log/wtmp
cat /dev/null > /var/log/btmp
cat /dev/null > /var/log/lastlog
cat /dev/null > /var/log/auth.log
history -cw