![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace. |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
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 |
| Forum Sponsor | ||
|
|
|
|||
|
#!/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 |
|||
| Google The UNIX and Linux Forums |