1

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 ?

Update:

The script attached to #POSTBACKUP would resemble:

#!/bin/bash
rsync -ar /var/lib/automysqlbackup/ \
  backup@my_remote_backup_server:~/remote_backup/$HOSTNAME

1 Answer 1

2

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:

7
  • What does your postbackup script look like?
    – quanta
    Mar 11, 2013 at 9:36
  • See my updated.
    – quanta
    Mar 11, 2013 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, 2013 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. Mar 11, 2013 at 13:39
  • 1
    Run it as a cron job of mysql instead of root.
    – quanta
    Mar 11, 2013 at 14:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .