#!/usr/bin/env bash set -euo pipefail if [[ $# -ne 1 ]]; then echo "Usage: $0 example.com" >&2 exit 1 fi domain="$1" root="/var/www/$domain" if [[ ! -d "$root" ]]; then echo "Site root not found: $root" >&2 exit 1 fi echo "Normalizing ownership and permissions under $root" # Ownership chown -R root:webdev "$root" # Directories: 2775, Files: 664 find "$root" -type d -exec chmod 2775 {} \; find "$root" -type f -exec chmod 664 {} \; echo "Done."