Rsync with non-standard ssh ports

This problem appears when I try to rsync directories with hosts inside a cluster used NAT for forwarding ports to internal nodes. Hence, the ssh port for internal nodes are not the default 22. So, how to use rsync with the non-standard ssh ports?

The -e options of rsync play the trick very well. For example, to use ssh to example.com with port 13022:

$ rsync -avxP --delete -e "ssh -p 13022" 
you_username@example.com:/remote/path/ /local/path/
Answered by Eric Z Ma.

Eric Z Ma

Eric is a father and systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

Leave a Reply

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