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

test -x /usr/sbin/automysqlbackup && /usr/sbin/automysqlbackup

My files are stored here


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 ?


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

  • 1
    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 Mar 18 '13 at 14:11
  • 1
    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. Mar 19 '13 at 9:19

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
  • THank you. I saw this blog. But files doesn't seem to inherit the permissions/user/group Mar 18 '13 at 12:19
  • I chmoded -R gu+s to use sticky bits so the owner is kept, but not the permissions. Mar 18 '13 at 12:24
  • you can use setfacl, i update answer.
    – Rainbow-
    Mar 18 '13 at 12:38

automysqlbackup certainly doesn't inherit permissions from parent directory. I don't know why an option for setting permissions has never been added because it's a nobrainer.

For Debian I did the following:

In /etc/default/automysqlbackup added:


Then I copied the script to the user home who runs the cronjob (so it doesn't get overwritten by system upgrade) and changed line 426:


# Database dump function
dbdump () {
        touch $2
        chmod 600 $2


# Database dump function
dbdump () {
    touch $2
    chmod ${FILEPERM} $2

Now all permissions are set to what's given in the configuration file. Of course I have to update the cronjob to /home/user/automysqlbackup

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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