Re: Old user list
From: Chladek, Dave (Dave.Chladek_at_NHMCCD.EDU)
Date: 07/28/04
- Previous message: Harvey, Bruce T.: "Re: F40 Service Processor ???"
- Maybe in reply to: Hass, Harold: "Old user list"
- Next in thread: Hass, Harold: "Re: Old user list"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 28 Jul 2004 14:06:17 -0500 To: aix-l@Princeton.EDU
Here is a cool utility to convert time...
http://www.unixreview.com/documents/s=1344/ur0307g/ur0307g_script.htm
... and the following is an unmodified script I picked up from
somewhere, but I don't remember where, and between the two scripts you
should be able to work out your question and probably one or two others
you have not asked...
#!/usr/bin/ksh
#set -x
#Try this script.
#It will check and lock the accounts automatically for those logins that
#have not been used to s set number of days.
expdays=90 #<< ---- Set number of days in past here!
let expiry=86400*$expdays
locked=" "
tmp1=/tmp/exp.tmp1.$$
tmp2=/tmp/exp.tmp2.$$
tmp2a=/tmp/exp.tmp2a.$$
tmp3=/tmp/exp.tmp3.$$
tmp4=/tmp/exp.tmp4.$$
# List all users that are allowed to login
lsuser -a login account_locked time_last_login ALL |grep -Ev
^"root|daemon|bin|sys|adm|nobody" | grep "login=true" > $tmp1
# get all users who have logged in at least once with login date
grep 'time_last_login' $tmp1 | sed -e 's/login=true //' -e
's/account_locked=//' -e 's/time_last_login=//' >$tmp2
# get all users who have not logged in since creation
grep -v 'time_last_login' $tmp1 | sed -e 's/login=true //' -e
's/account_locked=//' >$tmp2a
# get today's date in seconds from epoch for comparison
year=`date +%Y`
day=`date +%j`
hour=`date +%H`
minute=`date +%M`
let today="($year - 1970) * 365 * 86400 + ($day - 1) * 86400 + $hour *
3600 + $minute * 60 + ($year - 1969) / 4 * 86400"
# for each user found, check whether has not been unused too long
cat $tmp2 |while read user locked last
do
let min=$today-$expiry
if [[ $min -gt $last ]]
then
let login="($today - $last) / 86400"
echo $user':'$login':'$locked >> $tmp4
#chuser shell='/usr/local/bin/locked'
#account_locked='true' $user
fi
done
HTH,
Dave Chladek
-----Original Message-----
From: IBM AIX Discussion List [mailto:aix-l@Princeton.EDU] On Behalf Of
Zebrouvis, Lois
Sent: Wednesday, July 28, 2004 1:24 PM
To: aix-l@Princeton.EDU
Subject: Re: Old user list
lsuser -a time_last_login userid (or ALL)
The time is in seconds from Jan 1st 1970
-----Original Message-----
From: Robert Miller [mailto:rmiller@SMUD.ORG]
Sent: Wednesday, July 28, 2004 2:04 PM
To: aix-l@Princeton.EDU
Subject: Re: Old user list
The quickest way to see when a person last logged on would be 'last -1
<username>' - that will give you one line detailing when they last
logged in. However, if the /var/adm/wtmp file gets truncated on a
regular basis, say through a cron job, it's only as good as the first
date of the wtmp file. To see the last entry (and thus the earliest
date), use 'last | tail -1', which will just give you the last line of
the "last" output (excuse the pun ;) )
The wtmp file is the only place I know of that has stored login info...
--rm
-----Original Message-----
From: IBM AIX Discussion List [mailto:aix-l@Princeton.EDU]On Behalf Of
Hass, Harold
Sent: Wednesday, July 28, 2004 10:42 AM
To: aix-l@Princeton.EDU
Subject: Old user list
I'm sure it's been answered before, and probably is in the archives, but
I can't find it!
How can I produce a list of users that have not logged in for a period
of time, say 8 months?
AIX 4.3.3 - AIX 5.2
TIA Harold Hass
- Previous message: Harvey, Bruce T.: "Re: F40 Service Processor ???"
- Maybe in reply to: Hass, Harold: "Old user list"
- Next in thread: Hass, Harold: "Re: Old user list"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
- Re: Old user list
... and the following is an unmodified script I picked up from ... lsuser -a login
account_locked time_last_login ALL |grep -Ev ... The wtmp file is the only place I know
of that has stored login info... ... TIA Harold Hass ... (AIX-L) - Re: Hacker activity?
... >login to a server, most as root but some are attempts to login to ... >telnet,
all come from the same remote server, and all fail. ... >getting some odd cgi calls
to a script on a secure ssl server. ... Make sure root cannot login to your system via
ssh. ... (freebsd-questions) - Abusing poor programming techniques in webserver scripts V 1.0
... $login = Request.Form ... fool the database parser. ... verified
in the script of access to the database, ... The SQL statement will be parsed by
the database manager, ... (SecProg) - e107 remote commands execution
... Login bypass / remote code execution / cross site scripting ... "e107 is a content
management system written in php and using the popular ... a script byrgod at <a
href="http://rgod.altervista.org " ... //so, you see, we activate public uploads and .php
extensions for attachments ... (Bugtraq) - Re: Limit desktop & start menu
... Create a login script that runs when users log into the TS, and map the R: ...
persisitent "R" drive on the server itself and that may cure it. ... (microsoft.public.windows.terminal_services)