check-default-account.sh 474B

1234567891011
  1. #!/bin/bash
  2. echo $(awk -F: '$1 !~ /^root$/ && $2 !~ /^[!*]/ {print $1 ":" $2}' /etc/shadow | awk -F ':' '{printf $1}' )| while read ACCOUNT
  3. do
  4. awk -F':' '{ if ( $3 <= 500 ) print $1 }' /etc/passwd | sed '/^root$/d' | while read ACCOUNTLIST
  5. do
  6. if [ "$ACCOUNT" == "$ACCOUNTLIST" ];then
  7. echo "There is at least one default account is using"
  8. exit 1
  9. fi
  10. done
  11. done