I started using restic recently to backup a production AWS EC2 server running Debian 11 that we use to host a Moodle website. I successfully configured the backup to use a S3 repository. After spending several hours the last few days reading various posts in this forum and other internet search results, I want to check my understanding.
For my use case, I want to backup Moodle’s main data folder (/var/www/moodledata) which is owned by the server’s www-user and Moodle’s MariaDB database to separate repositories I setup in our S3 bucket and use it for disaster recovery and to periodically sync recently changed data to a second development server. I log into the server’s console with the admin user.
In my restore tests, the owner of the subfolders and files was changed from www-data to admin. Is there a flag I overlooked that would retain the ownership when the backup is made or when the restore command is run?
If I remember what I read correctly, it seems that it might be best to mount the repository and use a tool like rsync to copy files to /var/www/moodledata on the development server. For example, rsync -avhi /tmp/restic-mount/hosts/ip-10-xx-x-xx/latest/var/www/moodledata/ /var/www/moodledata/
I need to do some more testing, but I think even doing that I might need to chown to www-data. On the development server, it might be simplest to remove /var/www/data, use restic restore to pull the latest backup copy from the S3 repository, and change the directory and file permissions.
Maybe someone in this forum has a recommendation of a better way to sync the development server with the S3 repository.
Thanks!