12345678910111213141516
  1. #!/bin/bash
  2. #In STIG there is only 5 kinds of permission : 0000, 0644, 0755, 0600, 0640
  3. LOCALTION=$1
  4. PERM=$2
  5. LEN=(stat $LOCALTION -c %a)
  6. #if permisiion of the file or directory
  7. if [ $LEN == 4 ];then
  8. exit 1
  9. fi
  10. let FPERM=777-$PERM
  11. find $LOCALTION -perm /$(printf "%03d\n" $FPERM) | wc -l | awk -F: '($1 != "0") {print; err=1} END {exit err}'