LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-04-2008, 06:09 PM   #1
blancs
Member
 
Registered: Mar 2005
Posts: 49

Rep: Reputation: 15
scp cronjob


can anyone tell me why this isn't working?

Subject: Cron <root@box> /usr/bin/scp -i /root/.ssh/id_rsa /var/log/ac/claud.log user@remote.org:~/dir/dir2/us2.log
Content-Type: text/plain; charset=ANSI_X3.4-1968
X-Cron-Env: <SHELL=/bin/bash>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>

Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password).
lost connection


when i run the string by it self it works fine. i've used the -i switch and set the shell to bash. I can't think of anything else. what am i missing here?
 
Old 10-04-2008, 11:59 PM   #2
blancs
Member
 
Registered: Mar 2005
Posts: 49

Original Poster
Rep: Reputation: 15
here is what im doing with -v option

new string running in cron:

/usr/bin/scp -2 -B -v -i /root/.ssh/id_rsa /home/dir/file.cfg username@remotehost.org:~/dir/file.cfg

Executing: program /usr/bin/ssh host remotehost.org, user myuser, command scp -v -t ~/dir/file
OpenSSH_4.7p1 Debian-8ubuntu1.2, OpenSSL 0.9.8g 19 Oct 2007
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to remotehost.org[*] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/id_rsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3p2 Debian-9etch3
debug1: match: OpenSSH_4.3p2 Debian-9etch3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.7p1 Debian-8ubuntu1.2
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: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'remotehost.org' is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:3
debug1: ssh_rsa_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: /root/.ssh/id_rsa
debug1: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
debug1: No more authentication methods to try.
Permission denied (publickey,password).
lost connection

Last edited by blancs; 10-05-2008 at 12:08 AM.
 
Old 10-05-2008, 08:09 AM   #3
Evo--
LQ Newbie
 
Registered: Oct 2008
Posts: 6

Rep: Reputation: 0
Quote:
Originally Posted by blancs View Post
here is what im doing with -v option

new string running in cron:

/usr/bin/scp -2 -B -v -i /root/.ssh/id_rsa /home/dir/file.cfg username@remotehost.org:~/dir/file.cfg

Executing: program /usr/bin/ssh host remotehost.org, user myuser,

<snip>

debug1: Trying private key: /root/.ssh/id_rsa
debug1: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
debug1: No more authentication methods to try.
Permission denied (publickey,password).
lost connection
Is this in your mortal user cronjob or in the root user cronjob? Because it looks like it's running as user myuser and that user isn't (and shouldn't be) able to read /root/.ssh/id_rsa.
 
Old 10-05-2008, 08:37 PM   #4
blancs
Member
 
Registered: Mar 2005
Posts: 49

Original Poster
Rep: Reputation: 15
it does run under the root user, i created under root using crontab -e option.

reading post im thinking maybe something should be done with ssh-agent. I'm not sure what i would need to do.

Last edited by blancs; 10-05-2008 at 08:50 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
scp does not work and gives the following error message: scp: FATAL: Executing ssh1 i akay Linux - Networking 16 09-29-2008 12:41 AM
cronjob --> my script to scp to remote server bskrakes Linux - General 5 07-04-2007 05:25 PM
cronjob help meeh Linux - General 1 03-26-2004 12:41 PM
cronjob ugob Linux - Software 0 03-03-2004 10:20 AM
cronjob FastEddy Linux - General 1 04-12-2003 10:52 PM


All times are GMT -5. The time now is 08:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration