Skip to content

Commit

Permalink
Set permission of FTP dumps directory after copying into it (#1478)
Browse files Browse the repository at this point in the history
In f5ed0b7 we changed from copying the contents of the FTP directory
with cp to using rsync, which also copies the permissions of the
source directory. This means that the permissions of $FTP_CURRENT_DUMP_DIR
were set to the permissions of $DUMP_DIR (700) instead of 755,
preventing world-read permissions and breaking ftp/http download.
In order to be explicit about what permissions are required, manually
chmod the directory at the same time that the files are chmod'd
  • Loading branch information
alastair committed May 24, 2021
1 parent 9800dac commit c67a874
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions admin/create-dumps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ FTP_CURRENT_DUMP_DIR="$FTP_DIR/$SUB_DIR/$DUMP_NAME"

# create the dir in which to copy the dumps before
# changing their permissions to the FTP_FILE_MODE
echo "Creating FTP directories and setting permissions..."
mkdir -m "$FTP_DIR_MODE" -p "$FTP_CURRENT_DUMP_DIR"
echo "Creating FTP directories..."
mkdir -p "$FTP_CURRENT_DUMP_DIR"

# make sure these dirs are owned by the correct user
chown "$FTP_USER:$FTP_GROUP" \
Expand All @@ -174,6 +174,8 @@ chown "$FTP_USER:$FTP_GROUP" \
# and set appropriate mode for files to be uploaded to
# the FTP server
retry rsync -a "$DUMP_DIR/" "$FTP_CURRENT_DUMP_DIR/"
echo "Fixing FTP permissions"
chmod "$FTP_DIR_MODE" "$FTP_CURRENT_DUMP_DIR"
chmod "$FTP_FILE_MODE" "$FTP_CURRENT_DUMP_DIR/"*

# create an explicit rsync filter for the new private dump in the
Expand Down

0 comments on commit c67a874

Please sign in to comment.