Is it possible to specify a different ssh port when using rsync

rsyncssh

I have been attempting the following command:

rsync -rvz --progress --remove-sent-files ./dir user@host:2222/path

SSH is running on port 2222, but rsync still tries to use port 22 and then complains about not finding the path, cause of course it does not exist.

I would like to know if it is possible to rsync to a remote host on a non-standard ssh port.

Best Answer

Your command line should look like this:

rsync -rvz -e 'ssh -p 2222' --progress ./dir user@host:/path

this works fine - I use it all the time without needing any new firewall rules - just note the SSH command itself is enclosed in quotes.

Related Topic