Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm using automysqlbackup, here is the default cron entry created

#!/bin/sh
test -x /usr/sbin/automysqlbackup && /usr/sbin/automysqlbackup

My files are stored here

/var/cache/automysqlbackup

I need to read them with my user but all the dumps are owned by root:root and 600

-rw------- 1 root root 945671 mars  12 06:49 my_2013-03-12.sql.gz
-rw------- 1 root root 951541 mars  13 06:32 my_2013-03-13.sql.gz
-rw------- 1 root root 956770 mars  14 06:31 my_2013-03-14.sql.gz
-rw------- 1 root root 961125 mars  15 06:53 my_2013-03-15.sql.gz
-rw------- 1 root root 969009 mars  17 06:38 my_2013-03-17.sql.gz
-rw------- 1 root root 969139 mars  18 06:38 my_2013-03-18.sql.gz

How can I configure automysqlbackup to use different owner and permissions ?

share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

Alternatively, last time I checked automysqlbackup was plain bash so one could easily make a modified local copy....

On Ubuntu, default install for automysqlbackup

$ sudo nano /usr/sbin/automysqlbackup

Search for chmod (only one occurrence) and replace 600 by 640 for example

share|improve this answer
    
Apparently it's still the case. I found a chmod 600 $2, I'm going to try to change it. Maybe I could set it as an option. I'll tell you –  Pierre de LESPINAY Mar 18 '13 at 14:11
    
Worked great thanks –  Pierre de LESPINAY Mar 18 '13 at 14:25
    
I would advise you dpkg-divert, or do not modify /usr/sbin/automysqlbackup itself but a copy instead which you wire up into cron instead of the distribution binary. Otherwise, a package update will wreck your changes since /usr/sbin/automysqlbackup is not marked as a conffile. –  rackandboneman Mar 19 '13 at 9:19
add comment

automysqlbackup not have option(how i know), but you can set permission of parent directory:

sudo mkdir /var/cache/automysqlbackup
sudo chgrp YourUserGroup /var/cache/automysqlbackup
sudo chmod 770 /var/cache/automysqlbackup

And files should be inherit group permission of parent directory when make backup. more info at https://dylansserver.com/note/automysqlbackup

update: other variant

mkdir test
chgrp guest test
chmod -R gu+s test
setfacl -d -m u::rw,g::rw,o::- test
cd test && touch file2 && ls -la file2
-rw-rw----   1 root guest    0 march 18 16:33 file2
share|improve this answer
    
THank you. I saw this blog. But files doesn't seem to inherit the permissions/user/group –  Pierre de LESPINAY Mar 18 '13 at 12:19
    
I chmoded -R gu+s to use sticky bits so the owner is kept, but not the permissions. –  Pierre de LESPINAY Mar 18 '13 at 12:24
    
you can use setfacl, i update answer. –  Rainbow- Mar 18 '13 at 12:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.