Visit Our UNIX and Linux User Community


How to find the year in last login details


 
Thread Tools Search this Thread
Operating Systems AIX How to find the year in last login details
# 1  
Old 06-08-2011
How to find the year in last login details

Hi Friends

I have a query. we had a requirement to see the last login details of our users so I ran the command last <username> and the output i get is:

wtmp begins Apr 17 21:48

Now I need to know couple of things:
1. How can I see the year this log is being read from wtmp file
2. Is there any way to find the data for the above command before April 17 or how the old log was deleted on April 17.

I know that our AIX system went into Production on June 2006.

Kindly advice.

Regards,
Leo.
# 2  
Old 06-08-2011
If you are sure there should be entries in the wtmp file and if you or anyone else has logged into that server then there should of course be entries in that file. I would guess that you have a corrupted wtmp file. What is the time stamp on the wtmp file?

Code:
ls -al /var/adm/wtmp

I don't think by default the wtmp file gets cycled but after it grows to a certain size so see if there are other wtmp files in the same dir.

Code:
ls -altr /var/adm/wtmp*

If there are others with some .extension then you can read those with

Code:
wtmp -f filename

If it were my server I would do the follow.

If you want to keep the current file copy it first.

Code:
cp -p /var/adm/wtmp /var/adm/wtmp.June082011
0> /var/adm/wtmp

The previous command will clean the file of any entries.

Then try logging in again and run the last command, hopefully you will see a new entry logged.
This User Gave Thanks to juredd1 For This Post:
# 3  
Old 06-08-2011
The "fwtmp" utility displays the fields from "wtmp" complete with the year.
This User Gave Thanks to methyl For This Post:
# 4  
Old 06-09-2011
thanks

Thanks Methyl & Juredd1...

Methyl thanks for suggesting fwtmp utility it really helped me in my query.

thanks again guys.

regards

leo
# 5  
Old 06-10-2011
If your are interested in only the last login time of users, you could also do:

Code:
# lsuser -f -a time_last_login time_last_unsuccessful_login ptr
ptr:
        time_last_login=1307690480
        time_last_unsuccessful_login=1307626391

# perl -e 'print scalar localtime 1307690480'
Fri Jun 10 09:21:20 2011

# perl -e 'print scalar localtime 1307626391'
Thu Jun  9 15:33:11 2011


Previous Thread | Next Thread
Test Your Knowledge in Computers #142
Difficulty: Easy
Version 4 Unix was rewritten in C in 1977.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Reporting last login details

Most of my Solaris 10 user accounts are generally 10 characters long. When I run the 'last' command the report only shows the first 8 characters so the information is not very helpful. How can I report the full 10 character user account. (1 Reply)
Discussion started by: PPOWER55
1 Replies

2. Post Here to Contact Site Administrators and Moderators

Changing login details

Dear Administrators! I would like to change my username for this forum, would it be possible? Regards FR (1 Reply)
Discussion started by: fretagi
1 Replies

3. Solaris

Sudo logging need year details also

Hi All I have a requirement in which during sudo logging, I must get the year details also in sudo log file. As below output is not mentioning the year due to this I will not able to idenfiy that this log belong to 2012 or 2011 or 2010 Dec 12 11:30:21 XYZ sudo: user1 : TTY=pts/5 ;... (4 Replies)
Discussion started by: sb200
4 Replies

4. Shell Programming and Scripting

passing login details to htaccess login prompt

Hi, How i can pass the login details to the URL which is password protected with the htaccess using command line or script (perl,or shell,or php). Any help or hint appreciated. Thanks, SJ (4 Replies)
Discussion started by: SilvesterJ
4 Replies

5. Shell Programming and Scripting

Last login with year

'last' command gives me date and time the user has logged in last. But how to get the date with year? (8 Replies)
Discussion started by: Soham
8 Replies

6. AIX

Last login details in banner

Friends!! I need your help. Where can i change/set the last login details as below in aix 5.3. And how to do that to get the results as exactly below login as: mbpops mbpops@xx.28.3.24's password: Last unsuccessful login: Mon Nov 22 14:32:27 GMT 2010 on ssh from 10.132.5.129 Last login:... (17 Replies)
Discussion started by: kmvinay
17 Replies

7. UNIX for Dummies Questions & Answers

Check login details

As a root user i switch to a different user say "oratest". I would like to know the details like at what time did the switch ( su - oratest ) happen. Are there any logs to check this Thanks. (4 Replies)
Discussion started by: jjoy
4 Replies

8. Solaris

How to : Find last login year in solaris ?

Thanks AVKlinux (10 Replies)
Discussion started by: avklinux
10 Replies

9. HP-UX

How to : Find last login year in HPUX ?

Thanks AVKlinux (4 Replies)
Discussion started by: avklinux
4 Replies

10. Shell Programming and Scripting

How to : Find last login year ?

Friends , With "last root | head -1 " command , we can find the last loging date and month . But i want to find last login year. Help me if u have any idea regarding this issue. Thanks AVklinux (3 Replies)
Discussion started by: avklinux
3 Replies

Featured Tech Videos