LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Other *NIX (https://www.linuxquestions.org/questions/other-%2Anix-55/)
-   -   Last login all user details with last login date needed (https://www.linuxquestions.org/questions/other-%2Anix-55/last-login-all-user-details-with-last-login-date-needed-885214/)

gadhave.vikas 06-08-2011 09:24 AM

Last login all user details with last login date needed
 
HI Techies,

I need the details of last login of all user with the last login date. (of all user, not only for those who have log in)

I have system with HP-UX OS installed.
(HP-UX B.11.00 U 9000/800 646319351 unlimited-user license)

I tried with the "last" command but not getting all user last login details with date.
command gives me only details about last login users and time, month,date not the year details.

Rgds,
Vikas

MensaWater 06-08-2011 12:45 PM

Interesting - I installed some HP-UX 11 systems in Vashi (Navi Mumbai) back in 1998. I wonder if you're using those.

Anyway the information is stored in /var/adm/wtmp as binary data. Since /var/adm/wtmp grows it isn't unusual for people to truncate it over time to free up space so it may not have all the history you want.

You can use fwtmp command to dump wtmp file into ASCII format and see the year for logins there. You'd have to script getting the last login for each user.

The dump can be done with:
/usr/sbin/acct/fwtmp </var/adm/wtmp

You can redirect that to a file:
e.g.
/usr/sbin/acct/fwtmp </var/adm/wtmp >/var/adm/crash/fwtmp.out

Note that /var/adm/wtmp is often very large so it is important that you be sure your target directory/filesystem has enough room for the ascii dump.

gadhave.vikas 06-10-2011 04:44 AM

Hye Mensa Water thanks for your reply,
Am not working at Vashi working with some ware else.

I check with your advice but I did not find the required information, as I need all users last login details, not only those who had logged in to the system. I check the wtmp.
wtmp gives me only those details who have at least logged in to the system at single time.
Any way’s nice for R & D
I found one script from Google which derived the details using last command and with the help of passwd file. but still I am facing one issue as the last command not giving me year details the last command gives me only time month and users details.

So please advise me if any command is there with providing user login details with year information.


Rgds,
Vikas

MensaWater 06-10-2011 01:50 PM

The btpm file shows failed logins. You can run the command I gave against it as well.

The last command uses the information from wtmp. The only way to get year information is by using the other command.


All times are GMT -5. The time now is 09:34 PM.