I use D6. Cron run often by some bots visiting example.com/cron.php Is it possible to change it somehow? Or restrict? I would like to prevent anonymous users to hit the script.I want to be able to run cron from drupal admin interface and also to run it automatically from linux crontab. I tried to set permissions to read for owner only (www-data is group) but it does not help.

Thank you.

  • Do you have access to your server? Nov 5, 2015 at 13:11
  • @MohammadAnwar Yes, I do.
    – loparr
    Nov 5, 2015 at 13:21
  • 1
    The answer is yes, for every scenario one could come up with, but what you actually need to do to achieve it depends on what you specifically want to accomplish. For example, if you only need to invoke cron.php yourself from the same machine, you can just exclude all external TCP traffic to that page in web server config. But maybe that's not your use case. There are a fair few ifs and buts with something like this
    – Clive
    Nov 5, 2015 at 13:24
  • @Clive updated question
    – loparr
    Nov 5, 2015 at 13:26
  • Righty-ho, you'll need to edit the code in cron.php for the "prevent anonymous users to hit the script" requirement. It's not aware of Drupal user roles currently
    – Clive
    Nov 5, 2015 at 13:27

2 Answers 2


Have you looked at Elysia Cron? I have it installed on all my sites as it allows finer control over how cron is run and has "Protection from external cron calling by cron_key or allowed host list"


I should of searched before posting question - did not know what to search for though:) Solution seems pretty simple here https://www.drupal.org/node/41049

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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