views:

393

answers:

4

Hello All

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 [email protected]:/public_html/ /var/www/domin.com/public_html

Hope you can advise.

Thank you in advance.

+1  A: 

The correct answer would be to use ssh keys

This site gives a guide to creatign and using ssh keys with rsync

Martin Beckett
A: 

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.

Laurence Gonsalves
Ive just seen the -password-file option. How what were would i add it ??
Lee
You just add --password-file=mypassword.txt to your rsync command-line, and make sure the file mypassword.txt contains the password in question. Make sure mypassword.txt is only readable to you. If you care about security, using ssh keys (as other have mentioned) would be better.
Laurence Gonsalves
A: 

Here is a pretty good howto on setting up rsync with ssh using the authorized keys feature of ssh. http://blogs.sun.com/jkini/entry/how_to_scp_scp_and

SSH is encrypted and the keys are much more secure than rsh authentication or using password files.

Dennis Baker
A: 

According to serverfault you can't, but there are some alternatives: http://serverfault.com/questions/24622/how-to-use-rsync-over-ftp

Kyle Brandt