#!/bin/bash if (( $# != 1 )); then echo "Usage: `basename $0` dir" fi DIR=$1 USER=root echo "Modifying $DIR with ownership $USER:web-content" echo -n "Is this okay (y/n)? " read ans if [ "$ans" != "y" ]; then echo "not setting permissions" exit 1 fi chown -R $USER:web-content $DIR find $DIR -type f -exec chmod 464 {} \; find $DIR -type d -exec chmod 2575 {} \; setfacl -k -R $DIR find $DIR -type d -exec setfacl -d -m u::rwx -d -m g::rwx -d -m o::rx {} \; find $DIR -name .htaccess -exec chmod 464 {} \; echo -n "Do yow want to chmod o-rwx $DIR (y/n)" read ans if [ "$ans" == "y" ]; then chmod o-rwx $DIR fi exit 0