Results 1 to 2 of 2

Thread: Problem using SSH and Cron

  1. #1
    Join Date
    Dec 2007
    Beans
    23

    Problem using SSH and Cron

    I am attempting to automate a script that executes commands on remote machines via ssh. I have public key authentication setup between the machines using ssh-agent. The script runs fine when executed from the command prompt. I suspect my problem is that cron isn't starting the ssh-agent due to it's minimalist environment. Here is the output when I add the -v flag to ssh:

    Code:
    debug1: Authentications that can continue: publickey,gssapi-with-mic,password
    debug1: Next authentication method: gssapi-with-mic
    debug1: Authentications that can continue: publickey,gssapi-with-mic,password
    debug1: Authentications that can continue: publickey,gssapi-with-mic,password
    debug1: Next authentication method: publickey
    debug1: Offering public key: /home/<user>/.ssh/id_rsa
    debug1: Server accepts key: pkalg ssh-rsa blen 149
    debug1: PEM_read_PrivateKey failed
    debug1: read PEM private key done: type <unknown>
    debug1: Trying private key: /home/<user>/.ssh/id_dsa
    debug1: Next authentication method: password
    debug1: Authentications that can continue: publickey,gssapi-with-mic,password
    Permission denied, please try again.
    debug1: Authentications that can continue: publickey,gssapi-with-mic,password
    Permission denied, please try again.
    debug1: Authentications that can continue: publickey,gssapi-with-mic,password
    debug1: No more authentication methods to try.
    Permission denied (publickey,gssapi-with-mic,password).
    How can I make this work? Thanks!

  2. #2
    Join Date
    Dec 2007
    Beans
    23

    Re: Problem using SSH and Cron

    starting the ssh-agent in the script before making the call to ssh did the trick.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •