Rsync remote site with bash

bashftplinuxmacosrsync

Hope you can advise I want to use rsync to carry out my FTP transactions but with bash.

How can I add the password to the rsync command.

I have for example.

rsync -r -update user@domain.com:/public_html/ /var/www/domin.com/public_html

Hope you can advise.

Thank you in advance.

Best Solution

From man rsync:

Some modules on the remote daemon may require authentication. If so, you will receive a password prompt when you connect. You can avoid the password prompt by setting the environment variable RSYNC_PASSWORD to the password you want to use or using the --password-file option. This may be useful when scripting rsync.