TUCoPS :: Password Security :: pwsec.txt

Check Password File (to be run by root)

#!/bin/sh
# ckpwd - Check Password File (ran by root)
umask 077
#cd /usr/local/bin/old
echo "*****Password File Check For 'Date'"; echo ""

echo "!!!!!! Accounts With No PassWord !!!!!!"
grep '^[^:]*::' /etc/passwd
if [ $? -eq 1 ]
        then
        echo "          * NONE FOUND *"
fi
echo ""

echo "!!!!!! Non-root UID=0 or GID=0 Accounts !!!!!!"
grep ':00*:' /etc/passwd | \
  awk -F: 'BEGIN        {n=0}
           $1 != "root" {print $0 ; n=1}
           END          {if (n==0) print "* NONE FOUND *"}'

echo ""

sort </etc/passwd >tmp1
sort <opg >tmp2
echo "!!!!!! Accounts Added !!!!!!"
comm -23 tmp1 tmp2
echo ""
echo "!!!!!! Accounts Dleted !!!!!!"
comm -13 tmp1 tmp2
echo ""
rm -f tmp1 tmp2
echo "*** Password File Protection ***"
echo "-rw-r--r--  1 root     wheel            >>> correct values"
ls -l /etc/passwd

echo ""; echo ">>> End Of Report."; echo ""




TUCoPS is optimized to look best in Firefox® on a widescreen monitor (1440x900 or better).
Site design & layout copyright © 1986-2024 AOH