Skip to content

Commit 85d03b2

Browse files
committed
Ensure correct backup folder permissions are set
Check if backup folder exists and have permission 755
1 parent 39509be commit 85d03b2

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

bin/v-backup-user

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,14 @@ check_backup_conditions
5656
if [ -z "$BACKUP" ]; then
5757
BACKUP=/backup
5858
fi
59-
mkdir -p $BACKUP
59+
60+
# Check if backup folder exists and have the correct permission
61+
if [[ ! -d "$BACKUP" ]]; then
62+
mkdir -p $BACKUP
63+
fi
64+
if [ $(stat -c %a $BACKUP) != 755 ]; then
65+
chmod 755 $BACKUP
66+
fi
6067

6168
# Get current time
6269
start_time=$(date '+%s')

bin/v-restore-user

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ is_format_valid 'user' 'backup'
6464
# Action #
6565
#----------------------------------------------------------#
6666

67+
# Check if backup folder exists and have the correct permission
68+
if [[ ! -d "$BACKUP" ]]; then
69+
mkdir -p $BACKUP
70+
fi
71+
if [ $(stat -c %a $BACKUP) != 755 ]; then
72+
chmod 755 $BACKUP
73+
fi
74+
6775
# Checking local backup
6876
if [ ! -e "$BACKUP/$backup" ]; then
6977
if [[ "$BACKUP_SYSTEM" =~ "google" ]]; then

install/hst-install-debian.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1843,8 +1843,9 @@ systemctl start hestia
18431843
check_result $? "hestia start failed"
18441844
chown admin:admin $HESTIA/data/sessions
18451845

1846-
# Create backup folder
1846+
# Create backup folder and set correct permission
18471847
mkdir -p /backup/
1848+
chmod 755 /backup/
18481849

18491850
#----------------------------------------------------------#
18501851
# Configure File Manager #

install/hst-install-ubuntu.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1871,8 +1871,9 @@ systemctl start hestia
18711871
check_result $? "hestia start failed"
18721872
chown admin:admin $HESTIA/data/sessions
18731873

1874-
# Create backup folder
1874+
# Create backup folder and set correct permission
18751875
mkdir -p /backup/
1876+
chmod 755 /backup/
18761877

18771878
#----------------------------------------------------------#
18781879
# Configure File Manager #

0 commit comments

Comments
 (0)