Re: Check when a user last logged in?
- From: Bill Campbell <bill@xxxxxxxxxxxxx>
- Date: Fri, 8 Aug 2008 14:07:34 -0700
On Fri, Aug 08, 2008, Jeff Hyman wrote:
Jean-Pierre Radley typed (on Fri, Aug 08, 2008 at 04:22:26PM -0400):
| Jeff Hyman typed (on Fri, Aug 08, 2008 at 10:11:49AM -0400):
| | Assasin.x@xxxxxxxxx typed (on Thu, Aug 07, 2008 at 04:18:40PM -0700):
| | | I'm trying to make a script that will remove/point out or delete old
| | | user accounts. The problem is, I have no idea how to check when a
| | | user last logged in!
| | |
| | | Checking the modification date of the home folder will not work
| | | because there are many users that use the same home folder. I had
| | | heard SCO has some sort of built in way of checking for this, or that
| | | there is a unix command that can do it.
| | |
| | | Anybody out there able to help me out?
| | |
| | | Thanks in advance!
| |
| |
| | # last user_name | head -2
| | ... or ...
| | # last user_name | head -2 | tail -1
|
| Since the original poster is looking for "old user accounts", the 'last'
| command is useless, because it will only provide login data for the
| last one to seven days -- unless one has changed root's crontab to run
| /etc/cleanup at some time other than early Sunday morining.
Hello JP,
Interesting.... looks like I turned that OFF.
I personally like being able to use 'last' and go back in history.
Things do pop up from time-to-time especially around payroll
conflicts.... but thanks for the input.
If I were doing this, I would put something in the system
/etc/profile that added a record to a database of some kind,
postgresql, mysql, or a simple hash (bdb, gdbm, etc.) containing
the username, time, tty, and IP address if available. Then it
would be easy to simply select on usrname, max(logintime) to see
the last time somebody logged in.
Going a step further, an appropriate ``trap'' statement that
would add a record on logout could give more information.
Bill
--
INTERNET: bill@xxxxxxxxxxxxx Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way
Voice: (206) 236-1676 Mercer Island, WA 98040-0820
Fax: (206) 232-9186
Marijuana will be legal some day, because the many law students
who now smoke pot will someday become congressmen and legalize
it in order to protect themselves. -- Lenny Bruce
.
- Follow-Ups:
- Re: Check when a user last logged in?
- From: Jeff Hyman
- Re: Check when a user last logged in?
- References:
- Check when a user last logged in?
- From: Assasin . x
- Re: Check when a user last logged in?
- From: Jeff Hyman
- Re: Check when a user last logged in?
- From: Jean-Pierre Radley
- Re: Check when a user last logged in?
- From: Jeff Hyman
- Check when a user last logged in?
- Prev by Date: Re: Booting problems - no physical floppy disk
- Next by Date: Re: DNS - nslookup & sendmail
- Previous by thread: Re: Check when a user last logged in?
- Next by thread: Re: Check when a user last logged in?
- Index(es):
Relevant Pages
|