I've a script which calls:
rsync --password-file=password.txt rsync://server/files /files
However, due to an unrelated error password.txt was missing.
In authenticate.c:auth_client, the code tries to read from the password file,
then tries the RSYNC_PASSWORD env var, then calls getpass(3). This last step is
causing problems as, even though the script is intended to run unattended, it
stops at the password prompt.
This only happens when running with a controlling tty (more specifically,
without a controlling tty getpass(3) can't open /dev/tty), for example, in the
%post script of a Redhat / Fedora kickstart file.
Demonstration:
# rsync -vv --password-file=password.txt rsync://server/files /files < /dev/null
opening tcp connection to server port 873
opening connection using --server --sender -vv . files
rsync: could not open password file "password.txt": No such file or directory
(2)
Password:
<< rsync waits forever here >>
Suggested fix is to error-out in auth_client() when the given requested
--password-file can't be used, rather than trying to continue with other
credentials.
Wrapping up rsync in a setsid caller avoids the problem, but dissociates from
the shell so it's impossible to catch exit status.
Quoting the manpage, "You can avoid the password prompt by ... using the
--password-file option." This is not true in all cases.
Apologies if this issue has already been discussed; I found nothing from
searching in bugzilla or the list archives.
Cheers,
Phil
--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html