swaroop has asked for the wisdom of the Perl Monks concerning the following question:

Hi , How to use rsync with ssh in perl script ( with different remote user name ) . Now I am using File::Remote module. But as the script should be non interactive I need to specify the password in a file. But using rsync command its not passing the password file ( --password-file ) if we use ssh. So , Any idea how to use ?? Thanks, Swaroop

Replies are listed 'Best First'.
Re: rsync with ssh
by friedo (Prior) on Apr 10, 2005 at 12:50 UTC
    If you want rsync, or any other application that uses SSH, to login without a password, you will need to setup a proper public/private key pair between the two machines. See Public key setup.
Re: rsync with ssh
by jhourcle (Prior) on Apr 10, 2005 at 13:03 UTC

    What happens when you try to do the rsync from the command line?

    What happens when you trigger it from cron, but not within Perl?

    I'd suggest trying to remove as much complexity as possible, until you can track down which component is causing the problem. (well, it may be an odd interaction issue between multiple parts.)

    See Using Rsync and SSH for information about using it from the command line. (I know I got into problems with certificates, when I tried connecting from a MacOSX box to a BSDI box, because of the different ways they wanted the certificate stored ... by testing command line first, you can confirm if it's a similar problem or not)

Re: rsync with ssh
by gam3 (Curate) on Apr 10, 2005 at 15:07 UTC
    This is what I would run on the command line. .../.ssh/my_tun needs to be a key that has no password.
    rsync -e "ssh -i /home/gam3/.ssh/my_tun" /tmp/test1 localhost:/tmp/test2
    
    
    -- gam3
    A picture is worth a thousand words, but takes 200K.