passing rsyncd password in a script (no ssh) - how?

Tomasz Chmielewski mangoo at wpkg.org
Wed Jan 10 11:40:13 GMT 2007


I want to transfer files from a Windows server running rsyncd to a local 
Linux machine. It has no SSH, so I can't use keys.

I need credentials to access files on the rsyncd server, so I thought 
using "expect" to pass a password in a script is the obvious choice:


/usr/bin/expect <<!
set timeout -1
spawn rsync --partial -a rsync://username@server/share/dir /local/copy

expect "Password: "

send "secret_password\n"

expect
!


However, this has a drawback that I loose the exit code produced by 
rsync (I'm no expect guru, so maybe perhaps there is a workaround to that).

What is the recommended way to copy files from a (password-protected) 
rsyncd server in a script?


-- 
Tomasz Chmielewski


More information about the rsync mailing list