0

when I run the following manually it runs perfectly:

/usr/bin/rsync -arvth -e "ssh -i /watch/scripts/word.pem" 1.1.1.1:/opt/ /opt

when it runs using crontab. I get:

Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). rsync: connection unexpectedly closed (0 bytes received so far) [receiver] rsync error: unexplained error (code 255) at io.c(600) [receiver=3.0.6]

what am I missing here?

Thanks! Dotan.

  • What command is being run from crontab? – NickW Nov 11 '13 at 11:39
  • /usr/bin/rsync -arvth -e "ssh -i /watch/scripts/word.pem" 1.1.1.1:/opt/ /opt – edotan Nov 11 '13 at 11:41
  • same command I ran manually is on the crontab – edotan Nov 11 '13 at 11:41
  • So, are you sure cron is running the script as the same user? – NickW Nov 11 '13 at 11:42
  • yes.....as root – edotan Nov 11 '13 at 11:42
0

it seems that when you copy an AMI (Image) from one region to another on Amazon and launch an instance on the new Amazon region. the authorized_keys keeps only the certificate from the origin region although a new one was created and not the new certificate. so you have to add it manually. Thanks, Dotan.

0

Cron does not run in the same environment (with the same environment variables) as you do in an interactive login shell. I would guess it has something todo with that.

You probably either have an ssh-agent at your local computer which you forward to get access to 1.1.1.1 or you have something else set as an environment variable that you need to access the server.

You can set environment variables for cron by setting them in the cron file:

VARIABLE=true
0 * * * * /usr/bin/rsync -arvth -e "ssh -i /watch/scripts/word.pem" 1.1.1.1:/opt/ /opt

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.