My requirement was to rsync /etc/yum.repos.d/ with another server running the SSH on port 1791. Normal rsync won’t work and we need to specify the rsync custom ssh port in the rsync command itself. The command I had to execute is below
Rsync over custom SSH port
rsync -av -e 'ssh -p 1791' /etc/yum.repos.d/ xx.xx.xx.xx:/etc/yum.repos.d
Rsync using SSH key:
rsync -avz -e "ssh -i /path/to/private/key" username@hostname or IP path/to/remote/files/ /local/files/
rsync using SSH key & Custom port
rsync -avz -e "ssh -i /path/to/private/key -p 1791" username@hostname or IP path/to/remote/files/ /local/files/