Rsync is a common command that users and administrator alike uses it to synchronize files. The closest function that Microsoft uses is xcopy .
Objective :
Copy folder over to a path in a remote server or remote host.
Scope :
- remote server is using port 9876 for the ssh.
- IP of remote server 123.123.123.123.
- OS used on the remote host is linux based regardless redhat or debian.
- firewall is properly configured.
Usually we will use :
- Redhat :
#rsync -avz –port=9876 /home/myfolder/mySrcFolder root@123.123.123.123:/home/myRemoteFolder/myTargetPath/ - Debian
#sudo rsync -avz –port=9876 /home/myfolder/mySrcFolder root@123.123.123.123:/home/myRemoteFolder/myTargetPath/
Notice the difference, due to default security in debian such as ubuntu, you need to use sudo.
Unfortunately, the command above would not work. A better solution is :
#rsync -avz –rsh=’ssh -p9876′ /home/myfolder/mySrcFolder root@123.123.123.123:/home/myRemoteFolder/myTargetPath/
Or
#rsync -avz -e ‘ssh -p9876’ /home/myfolder/mySrcFolder root@123.123.123.123:/home/myRemoteFolder/myTargetPath/
Please take note that you are required to understand how rsync is used locally before attempting this recommendation.