OK, I apologize for not figuring this out on my own through the dozens of online sites and questions here as well...but I'm in a time crunch and don't want to break anything.

I need to backup a folder and all subfolders and files from one Linux server (Gentoo) to a Ubuntu box on the same network, preferably using rsync.

Here's what I need:

  1. Can someone supply me the steps to make sure the Ubuntu target box is ready to receive the rsync (permissions, etc.)?
  2. The rsync script itself. All I need it to do is sync to the target nightly everything in the source folder/subfolders/files with permissions, etc. Ideal would be 5 copies called Monday/Tuesday/Wednesday/Thursday/Friday but I'm willing to live with a single copy that gets overwritten nightly (as long as the source doesn't change)



On the Gentoo box, do an "ssh-keygen" to generate SSH keys for the account running the cron. Make sure you don't set a passphrase for the private key.

On the Ubuntu box, put the public key from the Gentoo box into the target account's .ssh/authorized_keys file.

Assuming /path/to/files on the Gentoo box and /path/to/backups/ on the Ubuntu, you can then do something like:

rsync -v -a /path/to/files/ ubuntubox:/path/to/backups/`date +%A`/

which should put the contents of /path/to/files/ into something like /path/to/backups/Thursday/ on the Ubuntu box.

I would use a "-n" option in rsync when testing, to not actually write stuff to the target.

  • if the gentoo box is already rsyncing to another gentoo box, can I grab the ssh public key from that other gentoo server's .ssh/authorized_keys file? Or do I have to generate a new one? – TheCleaner Sep 1 '11 at 16:04
  • No need to generate a new key. You can copy a existing public key to Ubuntu server. – quanta Sep 1 '11 at 16:17
  • Do I need openSSH or similar installed on the Ubuntu box? Any other installs needed? – TheCleaner Sep 1 '11 at 16:22
  • You need the openssh-server package to be installed, and the sshd process running. – cjc Sep 1 '11 at 17:07

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.