The man page for rsync(1) states: --password-file This option allows you to provide a password in a file for accessing a remote rsync server. Note that this option is only useful when accessing an rsync server using the built in trans- port, not when using a remote shell as the transport. The file must not be world readable. It should contain just the password as a single line. I found that a newline is required after the line containing the password, at least in rsync 2.6.2. Without the newline character, I would see this error: [root@sql mail]# rsync -av --password-file=/root/.rsync/secrets-proxy \ archivist@proxy::mailarchive/ /sql/archive/mail @ERROR: auth failed on module mailarchive rsync: connection unexpectedly closed (95 bytes read so far) rsync error: error in rsync protocol data stream (code 12) at io.c(342) Upon adding a newline, the problem went away. Perhaps the documentation could be clarified: "...as a single line followed by a newline." Or something to that effect. What, you mean I'm not supposed to take it literally? :-) --Jon Johnson Sutinen Consulting, Inc. jon@sutinen.com
On Fri 07 May 2004, Jonathan Johnson wrote:> > I found that a newline is required after the line containing the > password, at least in rsync 2.6.2. Without the newline character, ITry the patch below. Paul Slootman --- authenticate.c.orig 2004-04-01 20:05:40.000000000 +0200 +++ authenticate.c 2004-05-08 13:04:59.000000000 +0200 @@ -139,6 +139,7 @@ int fd=0; STRUCT_STAT st; int ok = 1; + int n; extern int am_root; char *envpw=getenv("RSYNC_PASSWORD"); @@ -170,12 +171,15 @@ if (envpw) rprintf(FERROR,"RSYNC_PASSWORD environment variable ignored\n"); buffer[sizeof(buffer)-1]='\0'; - if (read(fd,buffer,sizeof(buffer)-1) > 0) + if ((n = read(fd,buffer,sizeof(buffer)-1)) > 0) { - char *p = strtok(buffer,"\n\r"); + char *p; close(fd); - if (p) p = strdup(p); - return p; + buffer[n] = 0; + if ((p = strchr(buffer, '\n')) || (p = strchr(buffer, '\r'))) + *p = 0; + if (*buffer) + return strdup(buffer); } return NULL;
On Fri, May 07, 2004 at 02:28:28PM -0700, Jonathan Johnson wrote:> I found that a newline is required after the line containing the > password, at least in rsync 2.6.2.This is a long-standing glitch in rsync. I've just checked in changes that makes both the reading of the password file (for the client) and the reading of the secrets file (for the daemon) work right when the file does not end with a newline. ..wayne..