Rsync’ing folders between remote machines

Rsync is an extremely powerful tool to transfer data between machines. Most of the time I use the following command to synchronize data between two machines.

rsync -razvute 'ssh -i /root/.ssh/id_rsa' SRC DST

Whereas the above command merely adds updated files from SRC to DST, use –delete to delete orphaned files in DST, i.e. files that have been deleted in SRC and should be deleted in DST too.

Also, in case you want to run rsync (for intance as a cron job) without having access to the remote machine’s private key try using sshpass. sshpass gives you the possibilitiy to enter password directly without requiring the remote machine’s private key.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *