When it comes to using and managing Linux/Unix based systems RSYNC has consistently proven itself a lifesaver for me. It is by far the easiest, safest, and most reliable way to copy, sync, and backup files. I’ve even started using it on Windows machines with Cygwin when I need a good way to transfer large amounts of data between drives. Now when using RSYNC to backup computers across networks I often come across situations where SSH is running on a non-standard port, something other than Port 22, and I need to figure out a way to let RSYNC know what port to run on.
Now when you’re just logging in with SSH it is as easy as using:
ssh -p 2222 email@example.com
and with SCP all you need to use is:
scp -P 2222 firstname.lastname@example.org:/remoteFiles /home/matthew/localFolder/
scp email@example.com:/remoteFiles /home/matthew/localFolder/
When you are using RSYNC though things are a bit different. You need to use the -e parameter like this:
rsync -avz -e "ssh -p 2222" firstname.lastname@example.org:/remoteFiles /home/matthew/localFolder/
Just like that you can run RSYNC on whatever port you need to get the job done. If you’ve never heard of RSYNC or aren’t using it and do any type of work involving file transfers/backups I highly recommend you check it out!