I am using rsync over ssh to backup directory structure. In that structure there is read-only folder with a few writable folders within. Content in these writable folders does change and needs to be backed up.

The main backup process works fine, but "backup of backup" (--backup --backup-dir) fails for folders in read-only folder with:

rsync: mkdir failed - permission denied

This is rsync command:

rsync -e "ssh -i some_key_file.pub -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" \
  --backup --backup-dir=backup_dir --force --ignore-errors --delete -a root_folder server:destination_folder/

This is folder structure:

-- read_only_folder
---- writable_folder

Rsync fails creating backup_dir/read_only_folder/writable_folder.

Because the main part of the backup does work (I assume rsync adjusts permission after syncing files), I am thinking that I am just missing something that would apply the same to the --backup-dir files.

  • I could not find solution for this other than changing adding u+w to the source directory that was read-only and resetting it back with u-w when rsync completes.
    – Sasha
    May 29, 2018 at 19:22


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.