Permission denied with bash.sh to run cron

Solution 1:

you can try the following solution as well:

chmod +x post.php
chmod +x bash.sh
echo "* * * * * /home/samitha/bash.sh >> /home/samitha/log/cron.log 2>&1" >> cronjob

chmod +x cronjob

/etc/init.d/crond start  #redhat based servers like centos
/etc/init.d/cron  start  #debian based servers like ubuntu

crontab cronjob

Solution 2:

The user executing that cron (the one who executes cron -e) doesn't have proper rights for executing that script. That is: either the script lacks the execution flag, or it's not possible to reach it because some of its ancestor directories lack the execution flag.