As part of a backup process, I run a regular rsync of several DokuWiki installations. All work fine, except for one, which gives permissions errors on cache files:
rsync: send_files failed to open "/var/www/site.name/htdocs/data/cache/0/083d96bbbbbc11b9c72ff0f363f2a921.xhtml": Permission denied (13)
Looking at the files in question, I see permissions like this:
-rw-r--r-- 1 www-data www-data 10 May 3 15:30 083d96bbbbbc11b9c72ff0f363f2a921.metadata
-rw-r----- 1 www-data www-data 2622 May 3 15:30 083d96bbbbbc11b9c72ff0f363f2a921.xhtml
I can fix them easily enough with a chmod, but the errors crop up again later. For some reason, some files are being written with the wrong (well, different) permissions. All the other installs write files with 644 permissions.
A couple of points:
* I have half a dozen DokuWiki sites (each a separate DokuWiki install) on this machine, all running under a single Apache instance. Only one is seeing this problem.
* This particular wiki has had no changes to content for over a year, yet the problem crops up again after fixing the permissions.
The machine is a Ubuntu 18.04 instance, running 2018-04-22b "Greebo"
Does anyone know what may be controlling the permissions, and causing them to be different on this one site?
It is not necessary (and maybe even not recommendable) to include the cache in the backup. Basically, you can always delete the entire contents of the cache directory. It is only for acceleration of DokuWiki.
HTH - Michael Sy.
Add: If I made changes (such as restoring a backup) to a DokuWiki via rsync, I would even delete the cache completely for safety's sake. Whether this is absolutely necessary, I do not know.
Okay, thanks, I may take a look at my rsync options.
That still doesn't answer the question of what is actually going on, and why this instance is behaving differently to the others though.
What are your dmode and fmode settings set to? What's the umask your PHP runs under?
Umask of the Apache process was 0022, I can't see PHP specifically setting it anywhere.
I don't set either fmask or dmask on the file system mount.
I have tried setting umask to 000 in /etc/apache2/envvars, but that doesn't seem to have made any difference (other than changing the umask fo the process).
Okay, some more digging around and it's also content files which are having the same problem (the wiki with the problem is pretty much dormant, so no new content has been added for a while).
However... further digging and I've discovered that the fmode/dmode values that andi was referring to are most probably the ones in the dokuwiki config rather than filesystem level configs. These are different (640/750) on the problematic wiki, and I've updated them to be 644 and 755. This has fixed the problem.
Thanks for your help.