全部博文(534)
分类: LINUX
2012-03-21 11:24:51
#!/bin/sh
for PASSWD_USER in `awk -F: '{print $1}' /etc/passwd` ; do
A=`grep -w ^$PASSWD_USER':x' /etc/passwd | awk -F: '{if($7~"false" || $7~"nologin") print "1";else print "0"}'`
B=`grep ^"$PASSWD_USER"':' /etc/shadow | awk -F: '{if(length($2)<20) print "1";else print "0"}'`
#echo "USER="$PASSWD_USER "A="$A "B="$B
if [ $A -eq 1 -o $B -eq 1 ] ; then
echo $PASSWD_USER
fi
done
exit 0