Information Security Stack Exchange is a question and answer site for information security professionals. It's 100% free, no registration required.

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 I'm not wrong in my understanding).


migration rejected from Jan 2 '15 at 21:08

This question came from our site for pro webmasters. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as off-topic by Gilles, Mark, Jens Erat, TildalWave, Steve Jan 2 '15 at 21:08

  • This question does not appear to be about Information security within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

This question appears to be off-topic because the only security aspect is due to a misinterpretation of the error message. It should have been migrated to Unix & Linux, not to Information Security. – Gilles Jan 2 '15 at 6:02
up vote 4 down vote accepted

Yeah.... your description of the situation makes absolutely no sense at all.

Root is god on a unix system. Root will be able to read, write and execute any file on your system unless you do something wonky with Selinux. The error message does not indicate a permissions problem either.

The situation is mostly like caused by the fact that your PHP script does not have a shebang line so your shell is unable to execute it correctly.

Add #!/bin/env php to the start of your file and it should work.

Also, in general it's a bad idea to run scripts like this as root. It probably suffices to have it run as whichever user is logically the owner of the file. – Stephen Touset Oct 15 '13 at 23:02

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