====== chmod www ====== ===== Ideas ===== find . -type f -exec chmod 664 {} \; && find . -type d -exec chmod 775 {} \; find ./* | while read file; do [[ -f "$file" ]] && chmod 644 "$file"; [[ -d "$file" ]] && chmod 755 "$file"; done ===== Script ===== #!/bin/bash # check if root if [[ $EUID -ne 0 ]]; then echo "This script must be run as root." 1>&2 exit 1 fi # check if params if [ $# -lt 1 ];then echo "Usage : chw " exit; fi # check for the folder if [ ! -d "${1}" ]; then echo "The folder ${1} does not exist." exit; fi cd "${1}" find ./* | while read file; do [[ -f "$file" ]] && chmod 664 "$file"; [[ -d "$file" ]] && chmod 2775 "$file"; done {{tag>bash}}