The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > AIX
Google UNIX.COM


AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
performing cleanup when a job finishes ChicagoBlues Shell Programming and Scripting 4 03-06-2008 08:41 AM
awk/sed/ksh script to cleanup /etc/group file pdtak Shell Programming and Scripting 6 02-27-2008 11:33 PM
Help with cleanup whdr02 Shell Programming and Scripting 2 01-25-2008 11:44 AM
pthread_cleanup_push/pop - cleanup handler problem sonicx High Level Programming 2 12-08-2007 10:15 PM
sendmail cleanup thomi39 UNIX for Dummies Questions & Answers 1 02-23-2006 05:48 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-11-2006
Registered User
 

Join Date: Dec 2005
Posts: 5
Stumble this Post!
Login ID cleanup

Hello

I have many old IDs on my AIX and would like to know the
simplest way of knowing the last time an ID was used.

I am familiar with the "last" command.

Thanks for any info
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-12-2006
Registered User
 

Join Date: Aug 2001
Location: Cape Town,South Africa
Posts: 41
Stumble this Post!
#!/bin/ksh
#set -vx
FALSE=false
current_time=$(perl -e 'print time (),"\n";')
let expired_time=current_time-7776000
let delete_time=current_time-15552000
awk -F: '{print $1}' /etc/passwd|while read records
do
if [ "$records" = "dm" -o "$records" = "root" -o "$records" = "daemon" -o "$records" = "bin" -o "$records" = "sys" -o "$
records" = "adm" -o "$records" = "uucp" -o "$records" = "guest" -o "$records" = "nobody" -o "$records" = "lpd" -o "$reco
rds" = "nuucp" ];then
SYS=$records
else
SYS=nonsys
fi
last_login_time=$(lsuser -a time_last_login $records|awk -F= '{print $2}')
account_status=$(lsuser -a account_locked $records|awk -F= '{print $2}')
if [ "$last_login_time" = "" ];then
if [ $records = $SYS -a "$records" != "root" -a "$account_status" = "false" ];then
# chuser account_locked=true $records
printf "%-8s never logged on. The account should be locked\n" $records
fi
if [ $records != $SYS -a "$records" != "root" ];then
# chuser account_locked=true $records
printf "%-8s never logged on. The account should be locked\n" $records
fi
elif [ $records = $SYS -a $records != "root" -a "$account_status" = "false" ];then
#chuser account_locked=true $records
printf "%-8s never logged on. The account should be locked\n" $records
elif [ $records != $SYS ];then
if [ $last_login_time -lt $delete_time ];then
printf "%-8s last logged on 6 months ago. The account needs to be deleted! Check /logs/backlogs/rmusers.log\n"
$records
echo $records must be removed. `date` >> /logs/backlogs/rmusers.log
elif [ $last_login_time -lt $expired_time ];then
# chuser account_locked=true $records
printf "%-8s last logged on 3 months ago. The account should be locked\n" $records
fi
fi
done
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:00 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0