last 命令只显示几天的登录信息

som*_*ing 2 security last output

我经常使用这个last命令来检查我的系统是否有未经授权的登录,这个命令:

last -Fd
Run Code Online (Sandbox Code Playgroud)

给我登录名,我用 ip 显示远程登录名。

来自man last

-F     Print full login and logout times and dates.
-d     For non-local logins, Linux stores not only the host name of the remote host but its IP number as well. This option  translates  the  IP
              number back into a hostname.
Run Code Online (Sandbox Code Playgroud)

题:

我的一个系统只显示了几天的登录信息。这是为什么?last只给我几天时间,我能做什么?

这是有问题的输出:

root ~ # last -Fd
user pts/0        111-111-111-111. Wed Oct  8 20:05:51 2014   still logged in                      
user pts/0        host.lan   Mon Oct  6 09:52:01 2014 - Mon Oct  6 09:53:41 2014  (00:01)    
user pts/0        host.lan   Sat Oct  4 10:11:39 2014 - Sat Oct  4 10:12:13 2014  (00:00)    
user pts/0        host.lan   Sat Oct  4 09:31:07 2014 - Sat Oct  4 10:11:00 2014  (00:39)    
user pts/0        host.lan   Sat Oct  4 09:26:04 2014 - Sat Oct  4 09:28:16 2014  (00:02)    

wtmp begins Sat Oct  4 09:26:04 2014
Run Code Online (Sandbox Code Playgroud)

JRF*_*son 7

很可能logrotate已经归档了感兴趣的日志并打开了一个新日志。如果您有旧wtmp文件,请指定其中之一,例如:

last -f /var/log/wtmp-20141001
Run Code Online (Sandbox Code Playgroud)