Off Topic - run PHP script from shell as user

We are running a PHP script (via cron) to email our orders to a fulfillment center at 12:00 every night.

This was setup in Vmin in the vhost. In the Vmin cron setup page is says"run cron job as - username"

When we run the script it seems to run as root! any files that we write out are owned by root. Does this mean anyone executing a PHP script from the shell or cron can write out files anywhere in the system as root!!?

Question 2 is: Is there a way to run the PHP script as the vhost user??

Max<br><br>Post edited by: max, at: 2008/07/28 22:39

Hey Max,

What I might recommend doing is rather than logging in as root to add the Cron jobs, I’d log in as the Virtual Server owner to do that.

So after loging in as the Virtual Server owner, click “Webmin Modules” on the left, followed by “Scheduled Cron Jobs”. I’d then create or edit the Cron job from there.

That should make certain that the job is added to your Virtual Server owners crontab, rather than the system one.

That is the scary part!
I am almost positive I did it that way. I will go back and make a new one but I try to always login as the Vhost when doing stuff like this.

That is the scary part! I am almost positive I did it that way.

That would be scary, indeed…but I doubt it’s the case. I think we would have heard something by now about it. (And, obviously, we want to hear about it, if that is the case.)