UnixPedia : HPUX / LINUX / SOLARIS: HPUX :Script to find out lock-out user on the system

Sunday, January 20, 2013

HPUX :Script to find out lock-out user on the system

Below coed can be save as in file as lock.sh

#cat >lock.sh
Then run as hs or ksh
#ksh lock.sh
-----------------------------Start of file ------------------------------------------

for i in ` cat /etc/passwd | cut -d":" -f1`
do
lockout=`/usr/lbin/getprpw -m lockout $i`
LOCK=`echo $lockout |cut -c14`

if [[ $LOCK = 1 ]]
then
echo "--------------------user $i  is locked -------------"
else
echo " --------------------user $i is not locked -----------$i"
fi
done
-----------------------------End of file ----------------------------------------------

No comments:

Post a Comment