今天在使用last 命令时出现了如下错误:

root@instance-642k0w3w:~# last
last: /var/log/wtmp: No such file or directory
Perhaps this file was removed by the operator to prevent logging last info.

显示没有这个文件,可能是之前清楚日志的时候连文件一起删除了。现在给出解决方案,在shell命令行里直接输入:

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。
touch /var/log/wtmp ; chown root:utmp /var/log/wtmp ; chmod 0664 /var/log/wtmp
再次执行 last 命令,就正常了。
扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄