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 have a server for which I have created a cron job "sendalerts" to users. Mind you this "sendalerts.php" should be runnable from two methods (via browser and also via a cron job)

So cron's job is to execute a php file which then sends the alerts out, something like this:

01 01 * * * /usr/bin/php -f /var/www/vhosts/

But it keeps failing with the log message:

Could not open input file: /var/www/vhosts/

So I checked the file group and owner of "sendalerts.php" and realized it was "anothergroup" (since it was created through Plesk filemanager) for which "root" is not a member. I then deleted and recreated "sendalerts.php" from SSH with root. But this would not grant me access to running the same file in browser as I would sometimes want to (manually send the alerts).

Yet I get the same log error when cron tries to execute (Could not open input file: /var/www/vhosts/

Currently my possible solution would be:

to recreate the same file using Plesk filemanager and then add "root" user to the "anothergroup" group . But for this My QUESTION is : would that be a safe and secure thing to do? considering now the group "anothergroup" may have "root" user permissions (if im not wrong in my understanding)

Scout for other better solutions, Please if anyone has a better solution to this please suggest/advise me on this. Thanks,


share|improve this question

closed as off-topic by Falcon Momot, dawud, Ward, mdpc, Tom O'Connor Aug 19 '13 at 21:50

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must be relevant to professional system administration. Server Fault is a site dedicated to professionals; novice questions are off-topic. Please see the Help Center for more information on topicality. The best advice we can give you is to hire a professional to help you out." – Falcon Momot, dawud, Ward, mdpc, Tom O'Connor
If this question can be reworded to fit the rules in the help center, please edit the question.

how do you configure cron? which file? – GioMac Aug 17 '13 at 12:29

Adding root to said groups won't help as root should be able to access "anothergroup" GID owned files already.

Check the audit logs (some times located under /var/log/audit/) for any error message. For example SELinux or Apparmor may be preventing root from reaching into your directory through cron.

Other possible explanations may be that the /var/www/vhosts/ dir is located on an NFS share or the like, and root gets squashed? In that case I suggest you create a user who is a member of the "anothergroup" group and see if that helps.

share|improve this answer

Put the command in the crontab of a user who is member of "anothergroup".

However, I am wondering, usually root can access anything, why not here?

In any case, making root member of "anothergroup" won't hurt either. There's nothing on a system that is "run as the group". Stuff is only run as a user which is a member of group(s).

share|improve this answer

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