A user (csmu) encountered a backup failure due to permission issues, receiving a “Permission denied” error when tar tried to write to /var/www/discourse/public/backups/default/. Although root could create files in the directory, backups only succeeded after setting permissions to 777 — which the user is uncomfortable with for security reasons. RGJ suggested changing ownership to the discourse user, implying the backup process likely runs under that user rather than root. gerhard confirmed this behavior in a test Docker container: backups created via both the web interface and discourse backup command were owned by discourse and had appropriate permissions (644), with the backup directory being a symlink to /shared/backups, which is owned by discourse:www-data. The consensus suggests the fix is to set correct ownership (e.g., chown -R discourse:www-data /shared/backups) rather than using overly permissive 777.
csmu
(Keith John Hutchison - Ceiteach Seán Mac Úistin)
1
I’m getting a backup error with
[2020-10-17 23:40:29] EXCEPTION: lib/discourse.rb:92:in `exec': tar: /var/www/discourse/public/backups/default/bringing-data-to-life-2020-10-17-234010-v20200916085541.tar: Cannot open: Permission denied
tar: Error is not recoverable: exiting now
I’ve logged into the container, went to the directory and confirmed the root user can create files.
I changed the permissions to 777 and the backup worked. Even though this is private site I’m not keen on leaving 777 permissions on a possibly public link.
Does the backup process run with a different user from root?