Good day.

As you've probably surmised, chown needs to be run as the root user, even if
the file or directory in question is owned by the user wanting to make the

Setting up sudo access should work properly.  Ensure that the service is
actually running as "nobody" and not another unprivileged user.

However, it should be mentioned that this is a very, very insecure method!
The chown operator was designed more for PHP command-line scripts that would
be run as another user.  You may want to re-evaluate why you are changing
ownerships of directories from a web page, and determine if there is a
safer, more secure way of doing what you want.

Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948

-----Original Message-----
From: John Weez [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 15, 2002 11:55 AM
Subject: [PHP] chown ..opperation not permitted

Hi all,

My config is Apache 1.3 with PhP4 loaded as a module.

I have a script which makes a directory. This directory is owned by 
nobody.nobody because that is what apache runs as. But, I want this 
directory to be owned by a differrent user. So, After making the 
directory i use the php command chown to change the directory ownership. 
Now, I get an error saying opperation not permitted.

  I figured this is because of some security problems... So i try 
dropping in to the shell using teh backtick operator and by also setting 
up sudo to give access to the chown command to user nobody....this does 
not work from my php script BUT, it does work fine if i enter it on a 
shell line...

There must be a simple way that I can implement the chown function in 
php? Any ideas???


PHP General Mailing List (
To unsubscribe, visit:

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to