Rsync command with ssh port number

It is always recommended to copy the contents from local machine to remote machine or vice versa using rsync with ssh enabled. It’s insecure method to copy files via rsync without using ssh to other remote machines.

Here is the command to copy the contents between remote machines using rsync with ssh custom port number

rsync -avrz –rsh=’ssh -p2011 -i serverkey.pem’ source_content

Following is the command to exclude some contents from copying to other machine

In this case I don’t want to copy “source_content/tmp” directory to another machine and the command is

rsync -avrz –rsh=’ssh -p2011 -i serverkey.pem’ –exclude=source_content/tmp source_content

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)

Add a Comment

Your email address will not be published. Required fields are marked *