Today a colleague asked me to sync some files to a server that is not
listening on SSH
port 22.
I normally create a configuration entry in my ~/.ssh/config
file, like
Host tosync Hostname syncer.example.com Port 1234 User syncuser
and then command
rsync -va --progress --inplace . tosync:
But this time I didn’t want to create the entry in my SSH configuration,
because I need this trick in a script. So I started to read the rsync
manpage and after some experimenting I found
rsync -va --progress --inplace --rsh='ssh -p1234' . syncuser@syncer.example.com:
This syncs the current directory to host syncer.example.com
on port
1234
as user syncuser
.