Unix administration - Re: Need script to extract from /etc/security/lastlog -> list of

This is Interesting: Free IT Magazines  
Home > Archive > Unix administration > December 2004 > Re: Need script to extract from /etc/security/lastlog -> list of





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: Need script to extract from /etc/security/lastlog -> list of
Patrick Begou

2004-12-16, 7:45 pm

Tom Brehony wrote:
> The subject lines says it all. I am looking for a script (ideally Korn
> Shell)
> to extract from /etc/security/lastlog a list of users and their last login
> time
> in human readable format.
>
> I have seen PERL scripts to convert the Unix time in seconds to a human
> readable form, but I do not have PERL installed on the AIX 4.2 box
> I am using and I am not familiar with PERL anyway and would not be
> able to modify the script to do what I need.
>
> Anyone have something that will do this?
>
> Tom.
>
>


If using /etc/passwd you can do

for user in `cat /etc/passwd |cut -d : -f 1 |sort`
do
last $user|head -1
done

If using NIS you can do

for user in `ypcat passwd |cut -d : -f 1 |sort`
do
last $user|head -1
done


patrick
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com