I have been attempting the following command:
rsync -rvz --progress --remove-sent-files ./dir user@host:2222/path
SSH is running on port 2222, but rsync still tries to use port 22 and then complains about not finding the path, cause of course it does not exist.
I would like to know if it is possible to rsync to a remote host on a non-standard ssh port.
Rsync is primarily a utility for synchronizing files between systems in an efficient manner and is frequently used for archival and backup purposes as well as data distribution and sharing tasks. Rsync also has the ability to operate in a daemon mode where it listens on port 873/TCP.
Rsync uses ssh to sync files between two machines and usually it will use default identity file present in ~/. ssh/ directory on Linux. In case you want to use a custom rsync file you can use -e or –rsh option of rsync.
By default, the SCP command uses the port 22 (SSH). In case the remote system has configured the SSH service to run on a different port, you still can use SCP followed by the -P flag to specify the port you need.
Your command line should look like this:
rsync -rvz -e 'ssh -p 2222' --progress ./dir user@host:/path
this works fine - I use it all the time without needing any new firewall rules - just note the SSH command itself is enclosed in quotes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With