Browse Source

Ensure correct backup folder permissions are set

Check if backup folder exists and have permission 755
Jaap Marcus 4 years ago
parent
commit
85d03b2403
4 changed files with 20 additions and 3 deletions
  1. 8 1
      bin/v-backup-user
  2. 8 0
      bin/v-restore-user
  3. 2 1
      install/hst-install-debian.sh
  4. 2 1
      install/hst-install-ubuntu.sh

+ 8 - 1
bin/v-backup-user

@@ -56,7 +56,14 @@ check_backup_conditions
 if [ -z "$BACKUP" ]; then
 if [ -z "$BACKUP" ]; then
     BACKUP=/backup
     BACKUP=/backup
 fi
 fi
-mkdir -p $BACKUP
+
+# Check if backup folder exists and have the correct permission
+if [[ ! -d "$BACKUP" ]]; then 
+    mkdir -p $BACKUP
+fi
+if [ $(stat -c %a $BACKUP) != 755 ]; then
+    chmod 755 $BACKUP
+fi
 
 
 # Get current time
 # Get current time
 start_time=$(date '+%s')
 start_time=$(date '+%s')

+ 8 - 0
bin/v-restore-user

@@ -64,6 +64,14 @@ is_format_valid 'user' 'backup'
 #                       Action                             #
 #                       Action                             #
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
+# Check if backup folder exists and have the correct permission
+if [[ ! -d "$BACKUP" ]]; then 
+    mkdir -p $BACKUP
+fi
+if [ $(stat -c %a $BACKUP) != 755 ]; then
+    chmod 755 $BACKUP
+fi
+
 # Checking local backup
 # Checking local backup
 if [ ! -e "$BACKUP/$backup" ]; then
 if [ ! -e "$BACKUP/$backup" ]; then
     if [[ "$BACKUP_SYSTEM" =~ "google" ]]; then
     if [[ "$BACKUP_SYSTEM" =~ "google" ]]; then

+ 2 - 1
install/hst-install-debian.sh

@@ -1843,8 +1843,9 @@ systemctl start hestia
 check_result $? "hestia start failed"
 check_result $? "hestia start failed"
 chown admin:admin $HESTIA/data/sessions
 chown admin:admin $HESTIA/data/sessions
 
 
-# Create backup folder
+# Create backup folder and set correct permission
 mkdir -p /backup/
 mkdir -p /backup/
+chmod 755 /backup/
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 #                  Configure File Manager                   #
 #                  Configure File Manager                   #

+ 2 - 1
install/hst-install-ubuntu.sh

@@ -1871,8 +1871,9 @@ systemctl start hestia
 check_result $? "hestia start failed"
 check_result $? "hestia start failed"
 chown admin:admin $HESTIA/data/sessions
 chown admin:admin $HESTIA/data/sessions
 
 
-# Create backup folder
+# Create backup folder and set correct permission
 mkdir -p /backup/
 mkdir -p /backup/
+chmod 755 /backup/
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 #                  Configure File Manager                   #
 #                  Configure File Manager                   #