1. Test rsync over ssh (with password):
2. ssh-keygen generates keys.
Now setup ssh so that it doesn’t ask for password when you perform ssh. Use ssh-keygen on local server to generate public and private keys.
$ ssh-keygen Enter passphrase (empty for no passphrase): Enter same passphrase again:
Note: When it asks you to enter the passphrase just press enter key, and do not give any password here.
3. ssh-copy-id copies public key to remote host
Use ssh-copy-id, to copy the public key to the remote host.
ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.200.10
Note: The above will ask the password for your account on the remote host, and copy the public key automatically to the appropriate location. If ssh-copy-id doesn’t work for you, use the method we discussed earlier to setup ssh password less login.
4. Perform rsync over ssh without password
Now, you should be able to ssh to remote host without entering the password.
ssh 192.168.200.10
Perform the rsync again, it should not ask you to enter any password this time.
[dt_code]rsync -avz -e ssh /home/ramesh/ ramesh@192.168.200.10:/backup/ramesh/[/dt_code]
If you want to schedule this rsync backup job automatically, use cron to set it up.
Content for this post based on this post

