Re: Problems with scp and cron

From: Robert Nickel (Robert_Nickel_at_bigfoot.com)
Date: 10/21/04

  • Next message: Darren Tucker: "Re: OpenSSH failed non-root login"
    Date: Thu, 21 Oct 2004 10:24:23 +0200
    
    

    Alright. I figured it out.

    cron used another ssh than me and could not read my ssh2 private key file.

    Therefore using an absolute path to scp was enough.

    Thanks for your help

    Regards
    Robert

    Robert Nickel wrote:
    > Hi there,
    >
    > I have successfully established a public-private-key connection from a
    > RedHat Linux machine to a remote server via ssh. The remote username is
    > rnickel, my local is robert. So, as user "robert" I can type
    >
    > scp ~/tmp/* rnickel@remote:
    >
    > and everything works fine without passphrase-prompt.
    >
    > When running the same thing from a cron job (either from my own crontab
    > or from /etc/crontab as user robert) I get the error message
    >
    > Permission denied (publickey).
    >
    > (for my own crontab I have typed "crontab -u robert -e")
    > Can you tell me what the problem could be?
    >
    > Thanks in advance
    >
    > Robert Nickel
    >
    >
    >
    > Here is my script and the corresponding output:
    >
    > SCRIPT:
    > #!/bin/bash
    >
    > #
    > # copy files to remote
    > #
    > echo I am $USER from $HOSTNAME
    > scp -i /home/robert/.ssh2/identification /tmp/* rnickel@remote:
    > rm /tmp/robert/*
    >
    > OUTPUT (with verbose):
    > I am robert from baker.math.tu-cottbus.de
    > Executing: program /usr/bin/ssh host remote, user rnickel, command scp
    > -v -t .
    > OpenSSH_3.6.1p2, SSH protocols 1.5/2.0, OpenSSL 0x0090701f
    > debug1: Reading configuration data /etc/ssh/ssh_config
    > debug1: Applying options for *
    > debug1: Rhosts Authentication disabled, originating port will not be
    > trusted.
    > debug1: Connecting to remote [141.43.65.25] port 22.
    > debug1: Connection established.
    > debug1: identity file /home/robert/.ssh2/identification type -1
    > debug1: Remote protocol version 2.0, remote software version 3.2.9.1 SSH
    > Secure Shell (non-commercial)
    > debug1: no match: 3.2.9.1 SSH Secure Shell (non-commercial)
    > debug1: Enabling compatibility mode for protocol 2.0
    > debug1: Local version string SSH-2.0-OpenSSH_3.6.1p2
    > debug1: SSH2_MSG_KEXINIT sent
    > debug1: SSH2_MSG_KEXINIT received
    > debug1: kex: server->client aes128-cbc hmac-md5 none
    > debug1: kex: client->server aes128-cbc hmac-md5 none
    > debug1: sending SSH2_MSG_KEXDH_INIT
    > debug1: expecting SSH2_MSG_KEXDH_REPLY
    > debug1: Host 'remote' is known and matches the DSA host key.
    > debug1: Found key in /home/robert/.ssh/known_hosts:2
    > debug1: ssh_dss_verify: signature correct
    > debug1: SSH2_MSG_NEWKEYS sent
    > debug1: expecting SSH2_MSG_NEWKEYS
    > debug1: SSH2_MSG_NEWKEYS received
    > debug1: SSH2_MSG_SERVICE_REQUEST sent
    > debug1: SSH2_MSG_SERVICE_ACCEPT received
    > debug1: Authentications that can continue: publickey,password
    > debug1: Next authentication method: publickey
    > debug1: Trying private key: /home/robert/.ssh2/identification
    > debug1: PEM_read_PrivateKey failed
    > debug1: read PEM private key done: type <unknown>
    > debug1: Next authentication method: password
    > debug1: Authentications that can continue: publickey,password
    > Permission denied, please try again.
    > debug1: Authentications that can continue: publickey,password
    > Permission denied, please try again.
    > debug1: Authentications that can continue: publickey
    > debug1: No more authentication methods to try.
    > Permission denied (publickey).
    > debug1: Calling cleanup 0x8062d00(0x0)
    > lost connection
    >
    >


  • Next message: Darren Tucker: "Re: OpenSSH failed non-root login"

    Relevant Pages

    • cron and ssh
      ... I'm running SCO 5.0.5 and I'm having trouble getting cron to work with ssh. ... debug1: Sending command: cat parseshell/price.prn ... debug1: fd 0 clearing O_NONBLOCK ...
      (comp.unix.sco.misc)
    • RE: PuTTY SSH w/o a Password
      ... generates for a SSH session are: ... PuTTY SSH w/o a Password ... > I launch putty specifying the user name, private key file ...
      (RedHat)
    • Re: Rexx SSH and Cron
      ... Cron does not set an environment above the default. ... supposed to run the command. ... used when ssh is run in the background. ...
      (comp.lang.rexx)
    • Re: cron and ssh
      ... > I'm running SCO 5.0.5 and I'm having trouble getting cron to work with ... Here is the script I'm having ... > ssh linuxhost rm parseshell/price.prn ... Why does the command work if typed ...
      (comp.unix.sco.misc)
    • Re: output from cron ssh to VMS?
      ... know the Linux cron very well. ... Security auditing on the VMS system may give you a clue as to ... but ssh works for this task in other respects. ... I may experiment with VMS batch jobs ...
      (comp.os.vms)