Operating System - HP-UX
1826428 Members
4014 Online
109692 Solutions
New Discussion

Re: Scripting password expiration.

 
cuzfu
New Member

Scripting password expiration.

I need to set a list of users password expiration and I am having trouble. Can someone show me possibly how to take a list of users in a file and set their expiration to 90 days?

I am using /bin/passwd -x 90 user. Should I worry about min password age?
1 REPLY 1
A. Clay Stephenson
Acclaimed Contributor

Re: Scripting password expiration.

#!/usr/bin/sh

typeset INFILE="/xxx/mylistofusers"
typeset U=""
typeset EXPTIME=90
typeset MINTIME=7
typeset -i STAT=0
cat "${INFILE}" | while read U
do

/bin/passwd -x ${EXPTIME} -n ${MINTIME} ${U}
STAT=${?}
if [[ ${STAT} -ne 0 ]]
then
echo "Passwd failed on ${U}; status ${STAT}." >&2
fi
done
exit ${STAT}

---------------------------------------

Normally it is a good idea to set minimum time between passwords because suppose that your policy says that passwords may not be
resued. If your set maximum password history depth to 10, the user will easily be able to use the same password by cycling through 10 passwords on the same day. However if mintime is set to 7 then the user could not do this until 70 days have passed.
If it ain't broke, I can fix that.