HowTo synchronize two Linux server using rsync over ssh

When your need to replicate data from one server to another, the rsync solution is usefull. It works over ssh and you do not really have any specific thing to configure. Here are the options to be used to get a full copy with all the rights and ownership replicated :

 rsync -P -azc src_files_or_dir user@dest_server_ip:/dest_server_dir/

This works if the destination server have ssh open on port 22. If it is not the case another set of options is required :

rsync -P -azc -e "ssh -p dest_port" src_files_or_dir user@dest_server_ip:/dest_server_dir/

Hope it’ll help ! fro sure it will be a good reminder for me 😉

 

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.