in reply to Syncing Servers using Perl

This isn't a Perl question, it's an ssh question. Create an identity on the originating box, put the key in the authorized_keys file on the destination box, make sure the originating box can get to the key by means of ssh-agent or the like. If you're still having problems STFW for any of the umpteen bazillion howtos that are out there.

The cake is a lie.
The cake is a lie.
The cake is a lie.

Replies are listed 'Best First'.
Re^2: Syncing Servers using Perl
by jperlq (Acolyte) on Jun 26, 2008 at 14:05 UTC
    The ssh keys were setup, and Client1 is in Server1's authorized keys file.

    However the organization still requires a passphrase for .ssh/id_rsa, leading me back to my original question. How to automate this with perl.

      So, as I said: set up ssh-agent on the box with the identity, let that hold the passphrase guarded key for you, and it'll just work (presuming said ssh-agent is running, which may require some form of manual intervention if/when it restarts to unlock the identity for it). It's still not a Perl problem.

      If you're dead set on making it a Perl problem you'd want to look into something like Expect and let that drive your scp, but then you'd need to embed the plaintext passphrase somewhere in code and you've taken two steps back security-wise.

      The cake is a lie.
      The cake is a lie.
      The cake is a lie.

      Remove that passphrase from .ssh/id_rsa. If the passphrase is stored in a script anyway it doesn't provide additional security.

      BTW if you want to synchronize files one way, use rsync. If you want it two way, use unison - very cool tool.

        This would probably work if systems wasn't clever enough to centralize the .ssh/id_rsa keys.

        Server1 doesn't even contain id_rsa files in ~home/.ssh directories.