Transferring files with rsync using an SSH server running on a non standard port

To transfer files to or from a SSH server that is not running on the default port of 22 then you will need to specify the remote shell command line as follows:
rsync --rsh='ssh -p12345' asourcefile user@somehost:adestfile

The method above also allows other arguments to be passed to SSH.

Last updated: 15/08/2013