How to use rsync with different protocols, like FTP or WebDAV?

Published on Aug. 22, 2023, 12:18 p.m.

While rsync is typically used with the ssh protocol, it is possible to use it with other protocols like FTP or WebDAV using an appropriate rsync option. Here are some examples of how to use rsync with different protocols:

  1. FTP

To use rsync with FTP, you would need to specify the FTP protocol and credentials in the destination URL, and use the --rsh option to specify an FTP client program such as ftp or ncftp to use for the file transfer. For example:

rsync -avz --rsh=ftp --port=21 /local/dir/ [email protected]:/remote/dir/
  1. WebDAV

To use rsync with WebDAV, you would need to specify the WebDAV protocol and credentials in the destination URL, and use the --rsh option to specify an HTTP client program such as curl to use for the file transfer. For example:

rsync -avz --rsh="curl --digest --user user:password" /local/dir/ https://webdav.example.com/remote/dir/

Note that the above commands are just examples and may need to be adjusted based on your specific setup.