Search code examples
linuxcronpermission-deniedrhel6

crontab permission denied error


I put a file.sh for crontab to execute and redirecting the output into an email to my mailox. The script works when I run it manually. Unfortunately, when crontab does the job, it has the following error (from the output sent to me):

/bin/sh: /home/zenoss/zen-remote-bkup.sh: Permission denied

My crontab setup is the following:

30 11 * * * /home/zenoss/zen-remote-bkup.sh 2>&1 | mail -s "Zenoss backup replication" [email protected]

And these are the permission on the file.sh I need to execute:

-rw-rw-r-- 1 zenoss zenoss 1433 Nov  5 10:32 zen-remote-bkup.sh
[zenoss@server1 ~]$

Does anyone know which permission I am missing? Thank you.


Solution

  • You have to put the eXecutable bit on the script to do the job:

    chmod +x /home/zenoss/zen-remote-bkup.sh