Groesbeek, view of the 'National Liberation Museum 1944-1945' in Groesbeek. © Ton Kersten
Fork me on GitHub

rsync on a not standard port

2013-01-21 (131) by Ton Kersten, tagged as linux, sysadm

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.