View previous topic :: View next topic |
Author |
Message |
Seron Apprentice
Joined: 31 Dec 2002 Posts: 293 Location: Malmö, Sweden
|
Posted: Fri Apr 26, 2013 3:05 pm Post subject: [solved] user cron-job with ssh-agent/keychain, pubkey error |
|
|
I've set up a user cronjob for running a script to rsync using ssh. When I run the script on the command line I don't get prompted for the key passphrase, but when executed by cron I get the following email: Code: | Permission denied (publickey).
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(605) [Receiver=3.0.9] |
What could be the reason for this?
vixie-cron-4.1-r12
openssh-5.9_p1-r4
keychain-2.7.1-r1
script: Code: | #!/bin/bash
rsync --archive --update --verbose --compress --progress --rsh="ssh" --exclude='lost+found' source_srv:dir1/ /destination/dir |
ssh connection parameters are set in ~/.ssh/config. _________________ man cannot be brave without being afraid
Last edited by Seron on Fri Apr 26, 2013 3:27 pm; edited 1 time in total |
|
Back to top |
|
|
Seron Apprentice
Joined: 31 Dec 2002 Posts: 293 Location: Malmö, Sweden
|
Posted: Fri Apr 26, 2013 3:27 pm Post subject: |
|
|
I got it working by adding the following to the beginning of the script: Code: | eval "$(keychain --noask --eval id_dsa)" || exit 1 | as described in the Keychain Wiki. _________________ man cannot be brave without being afraid |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|