Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was using a script to perform rsync in sudo crontab. The script does a 2-way rsync (from serverA to serverB and reverse). After i reboot both the server machines, the rsync is not working in sudo crontab. I also setup a new cronjob and it fails, The error is: rsync error: unexplained error (code 255) at io.c(600) [sender=3.0.6] rsync: connection unexpectedly closed (0 bytes received so far) [receiver]

However, when run from terminal, the rync script works as expected without issues. please help.

share|improve this question

A little hard to answer given the almost total lack of relevant information but as a general rule, if a command works from the prompt but not from a cron job it's because you need to specify the full path to the command(s). Cron jobs do not have a normal user environment, which especially means they don't have the same PATH as regular users do.

share|improve this answer
I used to have a similar problem with rsync 2.6.8, evidently a bug that terminated croned tranmissions randomly, but I don't remember if it had that error code. It was under CentOS 5.5 at that time. Later with newer CentOS versions rsync came into 3.x and the issue is gone for good. – David Ramirez Nov 14 '13 at 16:54

This appears to happen when the connection is refused:

ssh: connect to host port 2222: Connection refused

followed by rsync error:

rsync: connection unexpectedly closed (0 bytes received so far) [receiver] rsync error: unexplained error (code 255) at /SourceCache/rsync/rsync-45/rsync/io.c(453) [receiver=2.6.9]

Possible reasons:

  • In my scenario, I had a firewall issue. Punched a hole.
  • wrong password (unlikely to address your issue, but will cause the same error)
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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