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