How to use a different SSH port with rsync

Posted by Andrew McCombe on Tue Apr 18, 2017

I’m forever forgetting how to use a different ssh port with rsync, so here’s how to do it.

rsync -avrn --rsh='ssh -p2222' dir1 [email protected]:path/to/dir1/

There. I now have somewhere to refer to the next time I forget.