Welcome, Guest
Please Login or Register.
Lost Password?
Off Topic - run PHP script from shell as user (1 viewing)
Post Reply

TOPIC: Off Topic - run PHP script from shell as user

#15186
max (User)
Posts: 52
graphgraph
Off Topic - run PHP script from shell as user 2008/07/28 21:23  
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??

Thanks,
Max

Post edited by: max, at: 2008/07/28 22:39
  The administrator has disabled public write access.
#15191
andreychek (Moderator)
Posts: 592
graphgraph
Re:Off Topic - run PHP script from shell as user 2008/07/29 04:42  
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.
-Eric
  The administrator has disabled public write access.
#15195
max (User)
Posts: 52
graphgraph
Re:Off Topic - run PHP script from shell as user 2008/07/29 10:34  
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.
  The administrator has disabled public write access.
#15202
Joe (Admin)
Posts: 4084
graph
Re:Off Topic - run PHP script from shell as user 2008/07/29 17:30  
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.)
  The administrator has disabled public write access.
Post Reply
get the latest posts directly to your desktop

Talk and Get Help

Support
Forums
Bugs and Issues

Get Virtualmin

OS Support
Buy Online
Download
Copyright 2005-2007 Virtualmin, Inc. All rights reserved.