From 29f030205e05648c1e82a110837fc892b4e4edf0 Mon Sep 17 00:00:00 2001 From: Peca Date: Wed, 16 Jul 2025 12:50:25 +0200 Subject: [PATCH] v-fix-website-permissions: exclude specific file types from permission changes to avoid altering 'Change' file attribute --- bin/v-fix-website-permissions | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bin/v-fix-website-permissions b/bin/v-fix-website-permissions index 03798a15..bc0d1ba5 100644 --- a/bin/v-fix-website-permissions +++ b/bin/v-fix-website-permissions @@ -69,8 +69,8 @@ fi echo "Updating permissions for /home/$USER/web/$domain/public_html/" -find public_html/ -type d ! -perm 755 -exec chmod 755 {} + -find public_html/ -type f ! -perm 644 -exec chmod 644 {} + +find public_html/ -type d ! \( -name "*.php" -o -name "*.env" \) ! -perm 755 -exec chmod 755 {} + +find public_html/ -type f ! \( -name "*.php" -o -name "*.env" \) ! -perm 644 -exec chmod 644 {} + find public_html/ ! -user $USER -exec chown $USER:$USER {} + php_chmod="600" @@ -80,8 +80,7 @@ fi # Setting chmod 600 for all php files echo "= Setting chmod $php_chmod for all php files" -find -name "*.php" -type f ! -perm $php_chmod -exec chmod $php_chmod {} + -find -name ".env" -type f ! -perm $php_chmod -exec chmod $php_chmod {} + +find -type f \( -name "*.php" -o -name "*.env" \) ! -perm $php_chmod -exec chmod $php_chmod {} + find -name "*.php" -type f ! -user $USER -exec chown $USER:$USER {} + find -name ".env" -type f ! -user $USER -exec chown $USER:$USER {} +