Question: How may I rsync the files to remote server which has custom ssh port number ?
Answer: To rsync the files and directories with ssh to remote server we use the option -e .
And to define the custom port number with ssh option within rsync command,we use the option -p.
rsync -avz -e 'ssh -p
' source destination
You can see the below given example:
rsync -avz -e 'ssh -p 2560' /opt/backup.tar email@example.com:~
In above given example:
ssh port number = 2560 (means port number 2560 is used for ssh rather than port no. 22).
source is /opt/backup.tar
root is a user for ssh authentication.Replace root with your available authenticating user.
destination is 192.168.40.1:~ (~ means user’s home directory)