Reference: http://www.thegeekstuff.com/2011/07/rsync-over-ssh-without-password/
$ sudo apt-get install rsync
Setup ssh so that it doesn’t ask for password when performing ssh. Use ssh-keygen
on local machine to generate public and private keys.
$ ssh-keygen
When prompted, do not input any password, just press Enter.
The file ~/.ssh/id_rsa
will be created. This is the identity to be used by the local machine to communicate to remote. (If this file is created as user1, you have to copy it in .ssh/ directory of root to also enable connections without password as a root.
The file ~/.ssh/id_rsa.pub
also generated by the previous procedure, will have to be copied to the remote machine.
$ ssh-copy-id -i ~/.ssh/id_rsa.pub user@remote_machine
####3. Running rsync for syncing files from local to remote machine.
Note This procedure is unidirectional. For bidirectional sync please check Unison.
Reference: https://www.digitalocean.com/community/tutorials/how-to-use-rsync-to-sync-local-and-remote-directories-on-a-vps
$ rsync -azP /pat/to/source/folder/ user@destination_machine:/path/to/folder/
This command will check the diff between source and destination files and change the remote version to the most updated version on the local machine. This is done only sending the incremental part, and compressing it if the z
option is used as in the present example.