From 2c9b6efedcf241b16005a56a79a116931e1a8e63 Mon Sep 17 00:00:00 2001 From: dimti Date: Fri, 8 Sep 2023 09:09:48 +0300 Subject: [PATCH] * fix DIRS_MODE - add execute bit for other users --- quick/restore-perms.sh.example | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/quick/restore-perms.sh.example b/quick/restore-perms.sh.example index a25f294..049753e 100644 --- a/quick/restore-perms.sh.example +++ b/quick/restore-perms.sh.example @@ -14,6 +14,8 @@ WP_CONTENT_DIRS=( ) export WEB_GID=33 +export DIRS_MODE=775 +export FILES_MODE=664 echo -n "Check sudo permissions... " @@ -48,18 +50,18 @@ perms() { # echo "Fixing permissions for dirs" # shellcheck disable=SC2038 # shellcheck disable=SC2016 - find $TMP_DIR/ -maxdepth 1 -type f -name "dirs-without-spaces-part-*" | xargs -I {} bash -c 'chmod 774 `cat {}`' + find $TMP_DIR/ -maxdepth 1 -type f -name "dirs-without-spaces-part-*" | xargs -I {} bash -c "chmod $DIRS_MODE `cat {}`" # echo "Fixing permissions for files" # shellcheck disable=SC2038 # shellcheck disable=SC2016 - find $TMP_DIR/ -maxdepth 1 -type f -name "files-without-spaces-part-*" | xargs -I {} bash -c 'chmod 664 `cat {}`' + find $TMP_DIR/ -maxdepth 1 -type f -name "files-without-spaces-part-*" | xargs -I {} bash -c "chmod $FILES_MODE `cat {}`" # echo "Fixing permissions for dirs with spaces" - cat $TMP_DIR/dirs-with-spaces | xargs -I {} chmod 775 "{}" + cat $TMP_DIR/dirs-with-spaces | xargs -I {} chmod $DIRS_MODE "{}" # echo "Fixing permissions for files with spaces" - cat $TMP_DIR/files-with-spaces | xargs -I {} chmod 664 "{}" + cat $TMP_DIR/files-with-spaces | xargs -I {} chmod $FILES_MODE "{}" # echo "Removing temporary files" rm $TMP_DIR/files-* @@ -68,7 +70,7 @@ perms() { else echo -n "and fixing permission for this file... " # echo "Fixing permissions" - chmod 664 "${TARGET}" + chmod $FILES_MODE "${TARGET}" echo "ok" fi }