Re: Check when a user last logged in?
- From: Jeff Hyman <scolist@xxxxxxxxxx>
- Date: Fri, 8 Aug 2008 16:42:16 -0400
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.
- Jeff H
#! /bin/sh
# @(#) cleanup 69.1 98/02/16
---- clipped ----
# Clean up super-user log.
cp /usr/adm/sulog /usr/adm/Osulog
/usr/adm/sulog
# If accounting isn't enabled, clean up wtmp and wtmpx,
# being careful not to create them if they don't exist.
if [ -x /usr/lib/acct/acct_enable ] && /usr/lib/acct/acct_enable -cs; then
: Do nothing - accounting will clean up wtmp and wtmpx
else
# Next 3 lines - Sun Apr 20 12:52:38 EDT 2003 - JBH
# I want the 'last' command to stick around so I can verifiy
# whos logged in or out.
sync
# [ -f /etc/wtmp ] && >/etc/wtmp
# [ -f /etc/wtmpx ] && >/etc/wtmpx
fi
# Clean up miscellaneous files.
find / -type f -name core -atime +7 -local -exec rm -f {} \;
.
- Follow-Ups:
- Re: Check when a user last logged in?
- From: Steve M. Fabac, Jr.
- Re: Check when a user last logged in?
- From: Bill Campbell
- 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
- Check when a user last logged in?
- Prev by Date: Re: Check when a user last logged in?
- Next by Date: Re: Booting problems - no physical floppy disk
- 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
|