Skip to main content

Remote server rsync using cron

Comments

4 comments

  • InterServed
    You will have to create a public/private key without a passphrase. Then you will need to specify the key on your rsync command. example: rsync -aupog -e 'ssh -p 1234 [COLOR="#FF0000">-i /root/.ssh/yourkey' root@123.45.67.89:/home/example/public_html/directory/ /backup/directory/
    Here's a guide to create the key : [url=http://www.thegeekstuff.com/2008/11/3-steps-to-perform-ssh-login-without-password-using-ssh-keygen-ssh-copy-id/]3 Steps to Perform SSH Login Without Password Using ssh-keygen & ssh-copy-id
    0
  • GoWilkes
    Thanks, that worked! I had to do a little bit of research on how to create the public/private key and copy it to the server with a different port, and in digging I found that it was a little easier than the article said. All I really had to do was, from the backup server: ssh-keygen -> Enter, Enter, Enter (blank on all 3) ssh-copy-id "root@123.45.67.89 -p 1234" (where 1234 is the port) Then, the rsync was the same code as before, I just didn't have the prompt for the password. I didn't need to include the '-i /root/.ssh/yourkey' section, for whatever reason (maybe because I left the first prompt blank after ssh-keygen?). Thanks again for pointing me in the right direction, InterServed! That helped a lot.
    0
  • InterServed
    You're more than welcome and yes I'm aware that it works without specifying the key, it's just how i normally do it. For me it's better to have a clearer understanding of the code so i know exactly what key is being used and so on. You can also generate/edit a key from WHM -> Security Center -> Manage root's SSH Keys
    0
  • cPanelMichael
    I am happy to see the solution that InterServed provided to you was helpful. Thank you for updating us with the outcome.
    0

Please sign in to leave a comment.