On Wednesday 07 August 2002 1:26 am, Jim Streit wrote:
> I have 3 servers that I am trying to replicate some information in a
> couple of folders.  I now use the rsync command and can successfully push
> updated information from 1 box to the other 2 boxes, but I have to do it
> manually.
>
> I've looked around on the web and the man pages.  I found some information
> about rsyncd.conf and a couple of other files, but I can't quite get it to
> work. I want to make a cron job that will automatically run a script that
> pushes out updated information to the other servers, but I keep getting
> prompted for a password when I run my script, just like it does when I run
> rsync manually.
>
> Does anyone have a good how-to or experience in doing what I'm looking for
> that could help me out?

Read up on ssh.  Generate an identiy that does not have a password, and use 
that identify for rsync

host A# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/users/jay/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in id_rsa.
Your public key has been saved in id_rsa.pub.
The key fingerprint is:
XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:X:XX jay at hostA
host A# scp .ssh/id_rsa.pub hostB:.ssh/hostA_rsa.pub
host A# ssh hostB
Password:
host B# cd .ssh
host B# cat hostA_rsa.pub >> authorized_keys
host B# chmod 600 *
host B# exit


After doing this, try this to double check it works (make sure it didnt prompt 
for a password):

host A# ssh hostB
host B# exit

Now you should be able to use rsync (with ssh) without a password:

host A# rsync -e ssh -av hostB:/my/dirs /backup


Jay