How to use rsync for custom SSH port

How to use rsync for custom SSH port
1 vote, 5.00 avg. rating (99% score)

By default rsync uses SSH port 22 while transferring the files/folders between two servers. If you are using custom SSH port instead of default port 22, you will need to add additional flag in rsync command as follow:

rsync -avz -e “ssh -p YOUR_SSH_PORT” user@SERVERADDRESS:/home/test /home/abc/

For more rsync option, you can use the following in your SSH:

[root@server ~]# man rsync

While using man command, if you receive an error called “bash: man: command not found”, you will need to install man on your server. For more details refer “Linux – man: command not found” article.

Kailash Aghera