X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=scripts%2Fsecurity%2Fharsh_perm.sh;fp=scripts%2Fsecurity%2Fharsh_perm.sh;h=fbce59fb95f4f3c6d4a169b5a7f176981e0afa30;hb=7b39f7e279005c8466ef508220a532ce2aa4abf8;hp=0000000000000000000000000000000000000000;hpb=3fbd372b35b15a19fb171d5ae34294ff7b1e6485;p=feisty_meow.git diff --git a/scripts/security/harsh_perm.sh b/scripts/security/harsh_perm.sh new file mode 100644 index 00000000..fbce59fb --- /dev/null +++ b/scripts/security/harsh_perm.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# harshperm traverses directory trees and sets the permissions to a restricted +# value (rwx------ for directories and rw------- for files). + +declare -a args=("$@") + +if [ -z "${args[*]}" ]; then + echo "no arguments provided." + exit 1; +fi + +for (( i=0; i < ${#args[*]}; i++ )); do + current="${args[i]}" +# echo "curr is $current" + + find -L "$current" -type d -exec chmod 700 {} ';' +# >/dev/null 2>/dev/null + find -L "$current" -type f -exec chmod 600 {} ';' +# >/dev/null 2>/dev/null +done