Q: Rsync, Batch: How to avoid the "password" ask ?

Tim Conway conway at us.ibm.com
Thu Jul 1 19:19:42 GMT 2004


on the server side, you seem to have done it correctly.
on the client side, you need some changes.  "--daemon" is not to tell 
rsync to connect to an rsyncd.  "rsync://" prefex or or "::"seperator do 
that. "--server is an option passed from an invoking rsync to the one on 
the other end of an external transport connection - rsh, ssh, maybe even 
local.  I don't know, because it's undocumented, because WE'RE NOT 
SUPPOSED TO USE IT ON OUR COMMANDLINES.

Your second one, the one that asks for a password, is much more sensibly 
phrased, and should almost work.  in its case, you are having nothing to 
do with the rsync daemon you started on BSERVER.  It's an external 
transport connection.  ssh is asking for a password, not rsync.  If you'd 
been connecting to an rsyncd, rsync would have use the password you 
correctly placed into $RSYNC_PASSWORD in the failed client-side example. 

SET BSERVER=192.168.0.102
SET RSYNC_PASSWORD=bart2
rsync -av --delete "/cygdrive/c/Doc/backup/Desktop/MesFavories.rar" 
bart2@%BSERVER%::backup_pa/current/bz/favories

This tells rsync to connect with its internal transport to the rsyncd 
running on 192.168.0.102 (on the default port, 873), and place 
/cygdrive/c/Doc/backup/Desktop/MesFavories.rar in the subdirectory 
current/bz/favories in the module "backup_pa", i.e., 
/mnt/hdc1/backup/current/bz/favories.  It connects with the rsync username 
(no relation to any unix username - you made it point to "nobody", as does 
"root") bart2, using the password "bart2" from the RSYNC_PASSWORD 
environmental variable.  I am surprised it works using a mix of unix path 
declarations and dos environmental declarations.  Since you're already in 
cygwin, I'd just use pure sh, or if you must run it from the dos 
environment, i.e. a bat file, I'd specify the windows side path in dos 
style.

Congratulations on getting so far along in the use of a very powerful (and 
therefore somewhat difficult to master) tool despite the language barrier, 
and without whining.

Tim Conway
Unix System Administration
Contractor - IBM Global Services
desk:3032734776
conway at us.ibm.com




Hi

Thanks for the info but either with or without SSH I got errors
So my config is :

Linux Side (Redhat 9) with rsync 2.6.2 as server
 Rsync config :
    rsync --daemon --config=/etc/rsyncd.conf

------     /etc/rsyncd.conf    : ----
motd file = /etc/rsyncd.motd
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock

[backup_pa]
   path = /mnt/hdc1/backup/
   comment = Mon Serveur Rsync
   uid = nobody
   gid = nobody
   read only = no
   list = yes
   auth users = root, bart2
   secrets file = /etc/rsync.scrt
-----------------------------------
------     /etc/rsync.scrt   : ----
bart2:bart2
-----------------------------------
Client side : Windows XP
     rsync 2.6.2 (from cygwin but only needed files not the Unix 
lookNfeel command prompt)
     Command file :
      SET BSERVER=192.168.0.102
      RSYNC_PASSWORD=bart2
      rsync --server --daemon -ave ssh --delete 
"/cygdrive/c/Doc/backup/Desktop/MesFavories.rar" 
bart2@%BSERVER%::backup_pa

and got this error at client side:

rsync: unable to open configuration file "rsyncd.conf": No such file or 
directory
rsync error: syntax or usage error (code 1) at 
/home/lapo/packaging/tmp/rsync-2.6.2/client
server.c(498)
----------------------------------------
The next command works fine at client side even if the linux rsync 
daemon is NOT launched.
rsync -ave ssh --delete "/cygdrive/c/Doc/backup/Desktop/MesFavories.rar" 
%USERNAME%@%BSERVER%:/home/bart2/backup/current/bz/favories

But it allways asks for a password !

Thanks in advance for your help

Regards,

Bart.






More information about the rsync mailing list