Nathalie Boulos [EMAIL PROTECTED] wrote:
> Hello,
> 
> i'm using rsync with ssh to connect to a remote host
> and mirror a website.
> 
> I want to put the command in crontab and i don't want
> ssh to ask for password before opening the connexion.

I assume from these statements that you want to use
rsync over ssh to do the transfer, right?

Disclaimer: I haven't actually setup rsync and ssh to
run from cron without being prompted for the ssh
passphrase, but I'm familiar with the basics - hopefully
this will help.  So take this with a grain of salt - you'll
need to do some testing to get this right.

You need to
  1. setup ssh properly so that you can ssh from the
     crontab user's account on the local host to the
     remote host without being prompted for a
     password, and then

  2. get the rsync command (with --rsh or -e specifying
     "ssh") to work manually, at the command prompt
     first, 

       login to the local host as the user who will
       run the crontab rsync command.  From the command
       line, run the rsync command manually - in the rsync
       command, specify the --rsh(or -e) with "ssh" to make
       it use ssh.  Once you can get this command to work
       manually, and get it to NOT prompt you for the ssh
       passphrase each time, then proceed to put the
       command in that user's crontab.

  3. once the rsync command (with ssh) works manually,
     then move on the put the rsync command in the users
     crontab.

Setting up ssh properly
-----------------------
Read the manpages for ssh, ssh-keygen, ssh-agent, and
ssh-add first.

You basically will login to the local(rsync source)
machine as the user who will be running the crontab
rsync, and generate an ssh private and public key pair.
Then you'll take the generated public key from the
local machine and copy the contents into an ssh keys
file on the remote machine in the account that will
be the recipient of the rsync.  This is the basic
architecture that will allow the local user to ssh
to the remote machine user account.

When you use ssh-keygen to generate an ssh keypair
(a private key "id_rsa", and a public key "id_rsa.pub"),
ssh-keygen prompts you to enter a "passphrase".

   If you *DON'T* want to be prompted for a passphrase
   when you execute the rsync using ssh, you can do
   one of two things:

      1. when prompted by ssh-keygen for a passphrase,
         just hit ENTER - in other words, don't enter
         a passphrase at all.  ***WARNING - this is
         *VERY* insecure.

      2. when prompted by ssh-keygen for a passphrase,
         enter a passphrase and remember it.  There
         are methods available that will allow you
         to ssh without being prompted for the passphrase
         each time, but you'll have to figure out
         which of the available methods suits you best.
         Read the manpages for ssh, ssh-keygen, ssh-agent,
         ssh-add, etc.

More docs:

  rsync home page:   http://rsync.samba.org/
  an rsync tutorial: http://everythinglinux.org/rsync/

HTH.
-- 
Hardy Merrill
Red Hat, Inc.


-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://www.redhat.com/mailman/listinfo/redhat-list

Reply via email to