rsync port 22 and 873 use

For context, the rsync documentation says

There are two different ways for rsync to contact a remote system: using a remote-shell program as the transport (such as ssh or rsh) or contacting an rsync daemon directly via TCP. The remote-shell transport is used whenever the source or destination path contains a single colon (:) separator after a host specification. Contacting an rsync daemon directly happens when the source or destination path contains a double colon (::) separator after a host specification, OR when an rsync:// URL is specified.

Port 22 is the SSH port; it’s used when you tell rsync to connect via SSH, with a single colon (the “remote-shell” case above). Port 873 is the rsync dæmon port; it’s used when rsync is used with a double colon or a rsync:// URL.

Most of the time you’ll be using SSH; using the dæmon requires specific setup. If you only ever want to use port 22, all you need to do is always specify a single colon in the remote host descriptor.


You can use parameter -e to specify the ssh port, e.g. rsync -rvz -e 'ssh -p $port' ./dir user@host:/path

Tags:

Ssh

Rsync

Daemon