Techy: rSync and scp over different ports

If you want to copy a file over scp using a different port number than usual, the syntax is:

Assume 1234 is the port number
scp -P 1234 user@remotehost:/folder/file.txt .

And if you want to do the same in rsync over SSH, then the syntax is:
rsync -av --progress -e "ssh -p 1234" user@remotehost:/folder/file.txt .

Note the different capitalisation of the port specifier (“p” is rsync’s ssh connection and “P” in scp).

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.