in reply to Re: Syncing Servers using Perl
in thread Syncing Servers using Perl

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.

Replies are listed 'Best First'.
Re^3: Syncing Servers using Perl
by Fletch (Bishop) on Jun 26, 2008 at 14:37 UTC

    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.

Re^3: Syncing Servers using Perl
by moritz (Cardinal) on Jun 26, 2008 at 14:08 UTC
    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.

        I don't understand that - why is it asking for a password for a file that's not present?

        Anyway, expect can be used to automate interaction with programs that read directly from the terminal (as ssh-askpass does, I think).