Hello,
I have to do a script which returns users who have never changed their password from /etc/shadow.
Here is what have I done and I'm not sure if it's ok.
I tried to return just users who doesn;t have password set or are locked.
Can be there other kind of user who never changed the password?
#!/bin/sh -x
USRFILE="/etc/shadow"
for i in `grep -v '^+' $USRFILE | cut -d: -f1,2`
do
userpname=`echo $i|cut -d: -f1`
password=`echo $i|cut -d: -f2`
if [ "x$password" -eq "x*LK*" ] || [ "x$passwd" -eq "xNP" ]
then
if [ "$RESULT" = "PASS" ]
then
RESULT="FAIL"
REASON="Users who have changed their password were found"
fi
echo "$userpname user in �/etc/shadow� without changed password."
fi
done
thanks and regards,
catalint