[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (VERY OT) Date last logged in



The best way to find out when a user has last logged in, is to use
the /var/log/lastlog file.  Do a man lastlog for more details on it.

Lastlog is a series of structs ordered by uid, containing the last
login information.  Index into the file at offset uid * sizeof lastlog
and you'll be at the right spot for that uid.  Much faster than trying
to wander in the wtmp to find the last login of someone who hasn't
been on your system in 88 days.

Perl is great for this kind of mucking around.

--STeve Andre'

At 09:21 AM 5/2/01 -0700, Chuck Yerkes wrote:
>This is log parsing and reporting.
>logins are, er, logged in syslog as well as wtmp.
>A file (db file?) with every user in it.
>Weekly, perhaps, run through the logs and update the
>last time each user logged in.  When done with logs,
>run through the db file to report each user than hasn't
>logged in since ($NOW - 90 days).
>
>While you're log processing, you might as well generate
>lots of other useful reports for your use.
>
>Too many people just logs stuff and never digest that info.
>It's interesting to remove the expected logs and see what's
>left :)
>
>Quoting InSaNe (stevenm@static-ip-138.sihope.com):
> > I am trying to find a way to write a shell/perl/c program/script that will
> > finger a user(or something else that works) and determine if they haven't
> > logged in for more than 3 months...
> >
> >
> > Like have it go through /home and then output a list of people who haven't
> > logged in withing 3 months, I am trying to delete inactive accounts.
> > Sadly, my poor beginner PERL skills just don't cut it.