pwage-aix for IBM AIX servers


 
Thread Tools Search this Thread
Operating Systems AIX pwage-aix for IBM AIX servers
# 1  
Old 03-25-2011
pwage-aix for IBM AIX servers

This is the password aging script for aix just completed. So far tested and still testing on one of our aix server running 5.3.0.0. So anyway as you can see it is very similar to pwage-hpux-T the only difference on aix /etc/passwd file looks in this format. Also for this script to work you need to have "+email@domain.com" at the end of your description in /etc/passwd file or the script won't work.

Quote:
aixguy:!:225:203:AIX Administrator +aixguy@unix.com:/home/aixguy:/usr/bin/ksh
sparcguy:!:225:203:Solaris Administrator +sparcguy@unix.com:/home/sparcguy:/usr/bin/ksh
hpuxguy:!:225:203:HPUX Administrator +hpuxguy@unix.com:/home/hpuxguy:/usr/bin/ksh
while encrypted password and password lastupdate date(in seconds) is stored in /etc/security/password with tabs in this format.

Quote:
aixguy:
Quote:
password = xxxxxxxxxxxxxx
lastupdate = 1261286093
So we just need to find a way to grab the lastupdate field for that we can use command sed -n -e "/$i/"{n; n; p;}' , then from there find time from 1970 in seconds minus lastupdate get it in days subtract that with 90 day password aging policy to get the days to expiry then send email.


Quote:
for i in `cat /etc/passwd | grep \@ | sed 's/:/+/' | cut -d+ -f1`
do
LASTPWCHG=`sed -n -e "/$i/ {n; n; p;}" /etc/security/passwd | sed 's/ //g' | awk '{ print $3 }'`
DAYSEC=`echo "60*60*24" | bc`
DAWNOFTIME=`/usr/bin/perl -e 'print int(time)'`
SECSAGO=`echo "$DAWNOFTIME - $LASTPWCHG" | bc`
DAYSAGO=`echo $SECSAGO/$DAYSEC | bc`
MAXAGE=90
LEFTDAYS=`echo $MAXAGE - $DAYSAGO | bc`
echo $LEFTDAYS
#
#
if [[ "$LEFTDAYS" = 7 ]]
then
EMAILID=`cat /etc/passwd | grep $i | sed 's/:/+/g' | cut -d+ -f6`
echo "Your unix id $i will expire in $LEFTDAYS days" | mailx -s "`uname -n` Password aging Reminder" $EMAILID
fi

if [[ "$LEFTDAYS" = 3 ]]
then
EMAILID=`cat /etc/passwd | grep $i | sed 's/:/+/g' | cut -d+ -f6`
echo "Your unix id $i will expire in $LEFTDAYS days" | mailx -s "`uname -n` Password aging Reminder" $EMAILID
fi

if [[ "$LEFTDAYS" -lt 0 ]]
then
EMAILID=`cat /etc/passwd | grep $i | sed 's/:/+/g' | cut -d+ -f6`
echo "Please note that your unix id $i has aleaady expired" | mailx -s "`uname -n` Password aging Reminder" $EMAILID
fi
done
feel free to modify/tighten to your requirements. All comments are welcome. Smilie
This User Gave Thanks to sparcguy For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

IBM Virtual Machine OS on intel x86 and x64? IBM AIX OS on IBM Virtual Machine?

Hi There, I have zero information and zero knowledge for IBM virtual machine except Amazon cloud and VMware ESXi (Only Linux OS available). Anyone could provide me the following answer - Can IBM VM been deploy on X86 and X64 (Intel Chip)? If answer is yes any chance to deploy AIX OS... (13 Replies)
Discussion started by: chenyung
13 Replies

2. AIX

AIX How to exchange hostname and IP address between two AIX servers?

Hi all, I am trying to exchange hostname and IP address of two AIX machines. But i am confused as how to change it ? do i need to use "smitty mktcpip" or "smitty tcpip" ? what is the difference between smitty mktcpip and smitty tcpip ? Also anymore steps to follow or just updating... (3 Replies)
Discussion started by: lramsb4u
3 Replies

3. AIX

IBM P5 AIX Installtion

Hello, I am new to the area of ​​IBM AIX. I want a AIX 6.1 on IBM P5 server with four scsi hard disk size is 72GB each. after the the new boot from cdrom for the installtion. I could not find any Hard Disk (hdisk0). how can I configure the hard disk or find the Hard disk by first... (1 Reply)
Discussion started by: alkhatw
1 Replies

4. AIX

IBM AIX 5.3 Display

Hi, all! I am new in IBM AIX 5.3. I tried to activate graphical display when connected to my UNIX server. 1) I downloaded Putty to connect to my UNIX server. 2) Then I downloaded Xming and installed it. After that I installed Xming fonts. 3)Then I downloaded AIX fonts and put them into... (7 Replies)
Discussion started by: Debuger
7 Replies

5. AIX

IBM AIX on IBM Eseries & x series server

Hi, I want to know whether IBM AIX can be installed on the IBM e series and x series server hardware? Thanks & Regards Arun (2 Replies)
Discussion started by: Arun.Kakarla
2 Replies

6. AIX

Completed IBM AIX

Yesterday I complted IBM AIX Certification (000-223). Passed 74% (8 Replies)
Discussion started by: udayn
8 Replies

7. AIX

ibm aix L1

hello all, can anyone send me ibm aix L1 interview questions... thank u guys...jiyojith (0 Replies)
Discussion started by: jiyojith
0 Replies

8. AIX

IBM-AIX Technical Help

Hi All :b:, Motto : I am in need of IBM-AIX INTERVIEW QUESTIONS. I am working as an a operator, on solaris 5.10 env. i have got an opportunity of IBM-AIX Administrator Job. I really don't want to miss this opportunity. By the way i have basic knowledge of Solaris UNIX, I have confident i... (7 Replies)
Discussion started by: imrankhan.in
7 Replies

9. UNIX for Advanced & Expert Users

how is IBM-AIX better..?

why IBM-AIX is preferred over HP-UX ..... In what way it is better for infrastructure......? Suggestions are welcome... Suggest you read the RULES (0 Replies)
Discussion started by: bishweshwar
0 Replies

10. AIX

Help-----ibm Aix???

:confused: Hello everybody, I am a totel dummy when it comes to UNIX!!! Must be wondering what I am doing here right? I'm most keen on knowing about-it-all. I need help. Wanna know all about the IBM AIX. The versions, the latest. Please tell me how do I go about my search. Thanks a... (3 Replies)
Discussion started by: rtanuja
3 Replies
Login or Register to Ask a Question