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.

Syntax:

rsync -avz -e 'ssh -p ' source destination

You can see the below given example:

rsync -avz -e 'ssh -p 2560' /opt/backup.tar root@192.168.40.1:~

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)

Read Some More Articles

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.