#navi(../)
* lastコマンドで過去のログイン履歴を見たい場合 [#s3727641]
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

#contents
#htmlinsertpcsp(linux_ads_top.html,linux-sp.html)

* 関連資料 [#z581ca66]
-[[ログインユーザの履歴を表示する・lastコマンド>逆引きUNIXコマンド/ログインユーザの履歴を表示する・lastコマンド]]
-[[不正ログインユーザの履歴を表示する・lastbコマンド>逆引きUNIXコマンド/不正ログインユーザの履歴を表示する・lastbコマンド]]

* wtmp begins 日時の意味 [#oe1e271c]
lastコマンドは/var/log/wtmpファイルを使用しています。~
''wtmp begins Wed Oct 10 08:20:59 2012''は、10/10 8:20:59に作成されたファイルを使用していることを示しています。~
したがって、過去のwtmpファイルは別名として保存されています。

* wtmpについて [#z2d16d04]
wtmpが保存されているログディレクトリでlsした結果です。
 $ ls /var/log/wtmp*
 /var/log/wtmp  /var/log/wtmp.1

wtmpとwtmp.1の2つのファイルが作成されています。~
wtmp.1の1は、1つ前のwtmpであることを示しています。

* 過去のwtmpを使用する [#v6481622]
以下のように-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系でも同様のファイル名およびディレクトリのはずです。

#htmlinsertpcsp(linux_ads_btm.html,linux-sp.html)

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS