If you install Koha with the Debian packages you get backups in /var/spool/koha/<instance>/ that look like this: -rw------- 1 root root 6616261 jan. 12 03:11 xxxxxxxx-2019-01-12.tar.gz -rw-r----- 1 root xxxxxxxx-koha 109473282 jan. 13 03:10 xxxxxxxx-2019-01-13.sql.gz -rw------- 1 root root 6677496 jan. 13 03:10 xxxxxxxx-2019-01-13.tar.gz -rw-r----- 1 root xxxxxxxx-koha 109473283 jan. 14 03:20 xxxxxxxx-2019-01-14.sql.gz -rw------- 1 root root 6721580 jan. 14 03:20 xxxxxxxx-2019-01-14.tar.gz -rw-r----- 1 root xxxxxxxx-koha 109473282 jan. 15 03:16 xxxxxxxx-2019-01-15.sql.gz -rw------- 1 root root 6723809 jan. 15 03:16 xxxxxxxx-2019-01-15.tar.gz -rw-r----- 1 root xxxxxxxx-koha 109473283 jan. 16 03:17 xxxxxxxx-2019-01-16.sql.gz -rw------- 1 root root 6770890 jan. 16 03:17 xxxxxxxx-2019-01-16.tar.gz Notice the difference in the permissions and the ownership of the files. Recently, I tried to turn on download of backups from the "Export" tool, with these settings in koha-conf.xml: <backup_db_via_tools>1</backup_db_via_tools> <backup_conf_via_tools>1</backup_conf_via_tools> This worked nicely for the db files, but not for the conf files, where the page just said "Unfortunately, no backups are available." I found a workaround was to do the following: $ sudo chmod 0640 /var/spool/koha/<instance>/* $ sudo chown root:<instance>-koha /var/spool/koha/<instance>/* After this, the files showed up as expected. This is due to the check on line 342 of /usr/share/koha/intranet/cgi-bin/tools/export.pl: return unless ( -f $filename && -r $filename ); The -r mens "File is readable by effective uid/gid." Looking around in Bugzilla, I found a patch for this problem, by Dobrica Pavlinusic, on bug 8437. That bug is mainly about downloading large files with Plack, and the permissions issue described here is fixed in a followup patch. I will try and move that patch to this bug, so the discussion about Plack does not block fixing the permissions.
Created attachment 84074 [details] [review] Patch from Bug 8437
Created attachment 84075 [details] [review] Bug 22143 - Fix permission and owner of configuration backups This allows backups created using Debian package to show up automatically in web interface and makes permissions of backup files consistent. Signed-off-by: Magnus Enger <magnus@libriotech.no> Original patch by Dobrica Pavlinusic. Moved from Bug 8437 by me. Tested thusly: - Look at backup files in /var/spool/koha/<instance>/ - Notice that permissions for .tar.gz files are -rw------- - Notice ownership of .tar.gz files are root:root - Apply this patch - Make sure the changes in the patch are applied to the script you run when you run "sudo koha-dump". This might include copying debian/scripts/koha-dump to /usr/sbin/koha-dump, if you are on a gitified setup. - Run the modified koha-dump - Notice that both backup files dated today are now -rw-r----- and ownership is root:<instance>-koha For extra testing credit: Set <backup_conf_via_tools>1</backup_conf_via_tools> in koha-conf.xml and verify that no files are listed under Tools > Export > Export configuration initially. After patching and running koha-dump the .tar.gz with the current date should show up.
Hi Magnus, this is a duplicate of bug 14564. I won't duplicate-link to it so I don't close your bug, but please take a look and see if you agree with the discussion. :)
*** This bug has been marked as a duplicate of bug 14564 ***
(In reply to Mirko Tietgen from comment #3) > Hi Magnus, this is a duplicate of bug 14564. I won't duplicate-link to it so > I don't close your bug, but please take a look and see if you agree with the > discussion. :) Thanks for pointing it out, bad searching on my part.