f08c77dad6af8e1955664354515566cf803ec49d
[feisty_meow.git] / scripts / security / harsh_perm.sh
1 #!/bin/bash
2 # harshperm traverses directory trees and sets the permissions to a restricted
3 # value (rwx------ for directories and rw------- for files).
4
5 declare -a args=("$@")
6
7 if [ -z "${args[*]}" ]; then
8   echo "no arguments provided."
9   exit 1;
10 fi
11
12 for (( i=0; i < ${#args[*]}; i++ )); do
13   current="${args[i]}"
14 #  echo "curr is $current"
15
16   find "$current" -type d -exec chmod 700 {} ';'
17 # >/dev/null 2>/dev/null
18   find "$current" -type f -exec chmod 600 {} ';'
19 # >/dev/null 2>/dev/null
20 done