3 bad_file="$HOME/bad_protections.txt"
4 if [ $# = 0 ]; then dirname=$HOME; export dirname;
5 else dirname=$1; export dirname; fi
7 echo "Searching for bad file protections in $dirname..."
8 echo "This includes any files that are writable by other or that have the"
9 echo "SetUID or SetGID bits turned on."
11 echo "Bad file modes and owners report for $(date_stringer)." >$bad_file
14 export outfile="$(mktemp "$TMP/zz_badprot.XXXXXX")"
16 echo "These files have bad modes:" >>$bad_file
17 find "$dirname" -type f -exec ls -AlF {} ';' >$outfile
23 grep '^[^l]' >>$bad_file
27 echo "These directories have bad modes:" >>$bad_file
28 find "$dirname" -type d -exec ls -Ald {} ';' >$outfile
30 #this is same as above block. make it a function.
36 grep '^[^l]' >>$bad_file
40 echo "Searching for Files Not Owned by the User in $HOME...."
42 bash $FEISTY_MEOW_SCRIPTS/find_non_owned.sh $HOME >>$bad_file
47 echo $(basename $0) " is finished. Showing report from $bad_file"
51 #optional: rm $bad_file