lastコマンドで過去のログイン履歴を見たい場合 †lastコマンドを実行すると以下のようにwtmp begins Wed Oct 10 08:20:59 2012と表示され過去のログイン履歴が表示されない場合の対応方法を以下に記します。 $ last sakura pts/1 xxx.xxx.xxx.xxx Wed Oct 1 09:30 still logged in tsubaki pts/0 xxx.xxx.xxx.xxx Wed Oct 1 09:10 still logged in sakura pts/0 fobarhoge Wed Oct 1 08:20 - 08:22 (00:01) wtmp begins Wed Oct 10 08:20:59 2012 関連資料 †wtmp begins 日時の意味 †lastコマンドは/var/log/wtmpファイルを使用しています。 wtmpについて †wtmpが保存されているログディレクトリでlsした結果です。 $ ls /var/log/wtmp* /var/log/wtmp /var/log/wtmp.1 wtmpとwtmp.1の2つのファイルが作成されています。 過去のwtmpを使用する †以下のように-fオプションを使用すればwtmpファイルを指定してlastコマンドを実行することができます。 last -f /var/log/wtmp.1 $ last -f /var/log/wtmp.1 <snip> root pts/2 xx.xxx.xxx.xx Thu Jul 20 03:26 - 03:27 (00:00) root pts/1 xx.xxx.xxx.xx Thu Jul 20 02:10 - 04:03 (01:52) root pts/0 xx.xxx.xxx.xx Thu Jul 20 02:07 - 04:03 (01:55) reboot system boot 2.6.18-308.el5 Thu Jul 20 02:06 (20:12) root pts/0 xx.xxx.xxx.xx Thu Jul 20 01:54 - down (00:05) root tty2 Thu Jul 20 01:03 - down (00:56) root pts/0 sakura Thu Jul 20 00:59 - 00:59 (00:00) root tty1 Thu Jul 20 00:59 - down (01:00) <snip> 本操作はCentOSで行いましたがDebian系でも同様のファイル名およびディレクトリのはずです。 |