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 have a server that holds all my backups and I would like to back them up to another server. I was just wondering the best way to do this.

do I setup rsync or use scp? I would also like to keep everything secure and use ssh if possible.

I keep the files under /home/servername/daily

share|improve this question
1  
possible duplicate serverfault.com/questions/255084/… –  Iain Feb 10 '13 at 9:12

3 Answers 3

I would recommend using rsync+ssh for security reasons. You can use either pull or push backup. For instance, if you decide to use pull based backup, first generate ssh key on the remote server. You will then pull the files to the remote server from the original backup server.

  1. Remote('another') server: generate private/public key

    ssh-keygen -t rsa -b 2048
    

    Take the public key generated, say /root/.ssh/id_rsa.pub, to the Backup server.

  2. Backup server - add public key of remote server to the authorized_keys of the backup server.

     cat id_rsa.pub >> /root/.ssh/authorized_keys
    
  3. Remote server -Test public key ssh connection

     ssh -i /root/.ssh/id_rsa root@backupserver-hostname
    

    Add the following command to your crontab

    rsync -avz -e "ssh -i /root/.ssh/id_rsa" root@backupserver:/backupdir /thisdir
    

You can change the username, hostnames, private/public key file names, directories etc. based on your setup.

share|improve this answer

crontab:

0 0 * * * rsync -av /home/servername/daily otherserver:/home/servername/dailyreplica

Midnightly crontab to rsync between the two servers.

Requires the root's (or whomever the crontab runs as)'s ssh key putting in the remote host's /home/$user/.ssh/authorized_keys file

share|improve this answer

If you're going to archive your backups, this command should work. The -e specifies to use ssh as the remote shell.

rsync -v -e ssh /path/to/local/backup.tar.gz user@backup_server:/directory/for/storage
share|improve this answer

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.