in reply to Re: Perl script in cron
in thread Perl script in cron

Well, the script is executed as the root user using roots rsa/dsa keys so I cant see that would be the problem. After turning on debugging for SSH in the script I found out that the passphrase authentication for the keys dont work under batchmode. And here is where I am at the moment, stuck :-) /Roger

Replies are listed 'Best First'.
Re^3: Perl script in cron
by shmem (Chancellor) on Dec 19, 2006 at 16:07 UTC
    Net::SSH::Perl always reads passwords and passphrases from the terminal (the tty). Passphrases therefore don't work in batch mode, by design. See Is Net::SSH::Perl broken for login via explicit user/password? for more info.

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
      So, the conclusion is that it does not work to use Net::SSH::Perl in batchmode without feeding the script password and by that giving up on RSA/DSA authentication with keys?
        The conclusion is: in batch mode
        • you can't feed the script a password
        • you can't feed the script a RSA/DSA key passphrase

        That's not a big deal, because, as I pointed out elsewhere, storing plaintext passwords and/or passphrases in a script or config file is at best unwise.

        You can use RSA/DSA keys, though, and afaik you can use custom keys (for your cron jobs). But anyways you should restrict the commands allowed on the target system for that keys with the command="someprogram" option in the ~/.ssh/authorized_keys file. See sshd(8) for more details.

        --shmem

        _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                      /\_¯/(q    /
        ----------------------------  \__(m.====·.(_("always off the crowd"))."·
        ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}