Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to configure an automatic MySQL backup solution under an Ubuntu server.

I have chosen automysqlbackup and rsync for this purpose (does it seem to be a good choice ?)

rsync will be used in the automysqlbackup #POSTBACKUP callback to send the backup to a remote server after each backup.

I found that automysqlbackup uses root as default user to make his operations.

How can I make automysqlbackup use a dedicated linux user so I'd be able to easily manage ssh keys and things like that ?


The script attached to #POSTBACKUP would resemble:

rsync -ar /var/lib/automysqlbackup/ \
share|improve this question

You can switch to another user before running rsync, something like this:

su - mysql -s /bin/bash -c 'rsync -ar ...'

Other some solutions that you might interested in:

share|improve this answer
What does your postbackup script look like? – quanta Mar 11 '13 at 9:36
See my updated. – quanta Mar 11 '13 at 11:14
Run it as mysql user instead of root. Make sure that mysql user has write permission to /var/lib/automysqlbackup/. – quanta Mar 11 '13 at 13:20
automysqlbackup runs automatically through cron and following directives from a config file. So I don't know where I should change this user. This config file does not specify the user. – Pierre de LESPINAY Mar 11 '13 at 13:39
Run it as a cron job of mysql instead of root. – quanta Mar 11 '13 at 14:30

Your Answer


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.