Off Topic - run PHP script from shell as user

4 posts / 0 new
Last post
#1 Mon, 07/28/2008 - 21:23
max

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??

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

Tue, 07/29/2008 - 04:42
andreychek

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 &quot;Webmin Modules&quot; on the left, followed by &quot;Scheduled Cron Jobs&quot;. 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

Tue, 07/29/2008 - 10:34
max

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.

Tue, 07/29/2008 - 17:30 (Reply to #3)
Joe
Joe's picture

<div class='quote'>That is the scary part!
I am almost positive I did it that way.</div>

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.)

--

Check out the forum guidelines!

Topic locked