Ignoring the security issues, I have the following script that synchronizes my music library from my MacBook Pro (running Snow Leopard) to the file store (CentOS 4) on my network:

rsync -rav --progress --partial -e "ssh" ~/Music/iTunes/* user@scramasax:~/music/iTunes-scissor:~

When I try to use either a password provided on the command-line (), in a password file (--password-file), or in the environment variable RSYNC_PASSWORD, the login still goes interactive, requiring me to type my password again.

I will be moving to pre-shared keys on my network, but in situations where that is not possible, such as rsync'ing files to a webserver, being able to successfully embed the password in the script would be very helpful.

link|improve this question

feedback

1 Answer

up vote 1 down vote accepted

Note what these sections from man rsync have to say about ssh. You'll probably have to set up keyfiles.

--password-file
This option allows you to provide a password in a file for accessing an rsync daemon. The file must not be world readable. It should contain just the password as a single line.

          This option does not supply a password to a remote shell  trans‐
          port  such  as  ssh; to learn how to do that, consult the remote
          shell's documentation.  When accessing an rsync daemon  using  a
          remote  shell  as  the  transport,  this  option only comes into
          effect after the remote shell finishes its authentication  (i.e.
          if  you  have  also  specified a password in the daemon's config
          file).

RSYNC_PASSWORD
Setting RSYNC_PASSWORD to the required password allows you to run authenticated rsync connections to an rsync daemon without user intervention. Note that this does not supply a password to a remote shell transport such as ssh; to learn how to do that, consult the remote shell's documentation.

link|improve this answer
that could explain it – warren Apr 13 '10 at 16:02
yes - that's it. I just didn't read far enough in the man pages. Thanks! – warren Apr 13 '10 at 16:29
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.