else echo "$NONE" fi echo "\n===== USERS WHO HAVE NOT LOGGED-IN IN \c" echo "THE LAST LOG2DAYS DAYS =====\n" if [ -s $STALE2 ] then sort $STALE2 | pr -t -w80 -8 else echo "$NONE" fi echo "\n===== USERS WHOSE .profile's ARE EXPLICITLY \c" echo "WRITABLE BY ANYONE =====\n" if [ -s $PROFS ] then sort $PROFS | pr -t -w80 -8 else echo "$NONE" fi rm -f $STALE1 $STALE2 $PROFS fi if [ -n "$passwdck" ] then echo "\n=====USERS WITH NO PASSWORDS =====\n" if [ -s $NOPW ] then sort $NOPW | pr -t -w80 -8 eclse echo $NONE fi echo "\n===== USERS WITH PASSWORDS THAT DON't EXPIRE =====\n" if [ -s $NOPWAGE ] then sort $NOPWAGE | pr -t -w80 -8 else echo "$NONE" fi echo "\n======USERS WHO CAN'T CHANGE THEIR PASSWORD =====\n" if [ -s $NOPWCH ] then sort $NOPWCH | pr -t -w80 -8 else echo "$NONE" fi rm -f $NOPW $NOPWAGE $NOPWCH if [ -x /etc/pwck ] then echo "\n===== RUN OF /etc/pwck =====\n" /etc/pwck fi echo "\n===== USERS WITH THE SAME UID=====\n" dupids=`cut -d: -f3 /etc/passwd | sort -n | uniq -d` if [ -z "$dupids" ] then echo "$NONE" else for id in $dupids do echo "$id:" sed -n "s/^\(.*\):.*:$id:.*$/\1/p" \ /etc/passwd | cut -d: -f1 | pr -o5 -w65 -t -5 echo done fi fi fi if [ -n "$grpck" ] then echo "\n ===== CHECK OF ADMINISTRATIVE GROUPS =====" for login in $grouplist do pwline=`grep "^$login:" /etc/passwd ` if [ -z "$pwline" then continue fi groupid=`echo $pwline | cut -d: -f4` if [ -n "$groupid" ] then members=`sed -n "s/^.*:.*:$groupid://p" /etc/group` if [ -n "$members" ] then list=`(echo "$members" | tr "," "\012"; sed -n "s/^\(.*\):.*:.*:$groupid:.*$/\1/p" \ /etc/passwd) | sort -b | uniq | fgrep -vx $login ` if [ -n "$list" ] then echo "\nThe followinf users are in the \c" echo "same group as $login ($groupid):\n" echo "$list" | pr -t -w80 -8 fi fi fi done if [ -x /etc/grpck ] then echo "\n===== RUN OF /etc/grpck =====\n" /etc/grpck fi fi # suite if [ -n "$user" -o -n "$fsys" ] then if [ -n "$user" ] then fsys=`grep "^$user:" /etc/passwd | cut -f6 -d:` if [ -z "$fsys" ] then echo "****can't find home directory for $user" >&2 exit 1 fi fi else fsys=/ # root fi if [ "$id" -eq $ROOTID ] then blockchar="-o -type b -o -type c" fi SIDBCFILES=sbcfiles$$ SIDFILES=sfiles$$ BCFILES=bcfiles$$ if [ -n "$sidck" ] then echo "\n===== CHECKING $fsys FOR SET UID AND GID FILES =====\n" find $fsys \(-perm -2000 -o -perm -4000 $blockchar \) \ -exec ls -ld {} \; > $SIDBCFILES 2>>ERRORS if [ -n "$blockchar" ] then sed -n "/^[bc].\{53\}\/dev\//d;/^[bc]/p" $SIDBCFILES grep -v "^[bc]" $SIDBCFILES > $SIDFILES else SIDFILES=$SIDBCFILES fi if [ -s "$SIDFILES" ] then tr -s " " "\011" < $SIDFILES | cut -f1,3,4,9 | tee ${SIDFILES}2 else echo "$NONE" fi if [ -n "$blockchar" ] then echo "\n=====BLOCK/CHARACTER SPECIAL FILES IN $fsys =====\n" if [ -s "$BCFILES" ] then tr -s " " "\011" < $BCFILES | cut -f1,3,4,9 else echo "$NONE" fi fi fi if [ -n "$readck$writeck" ] then if [ -n "$readck" ] then cmd="-perm -4" string="READABLE" fi if [ -n "$writeck" ] then if [ -n "$readck" ] then cmd="$cmd -o" string="$string/" fi cmd="$cmd -perm -2" string="{string}WRITABLE" fi echo "\n===== FILES IN $fsys THAT ARE $string BY\c" echo " ANYONE =====\n" FILES=file$$ fndother "$fsys" "$cmd" >$FILES if [ -s $FILES ] then egrep -v "$IGNORERW" $files | tr -s " " "\011" | sed "s/[0-9]\{1,\}, //" | cut -f1,3,9 | tee ${FILES}2 else echo "$NONE" fi fi if [ -n "$mailopt" ] then for file in ${SIDFILES}2 ${FILES}2 do if [ ! -s $file ] then continue fi