Files
WP-Ops/helpers/wo-fix-perms.sh
2026-01-01 19:23:51 +00:00

27 lines
462 B
Bash
Executable File

#!/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."