[thelist] PHP: mkdir and rmdir possible, but not chgrp, why?

Tobyn Baugher trb at cartoonviolence.net
Thu Mar 22 13:59:13 CST 2001

On Thu, Mar 22, 2001 at 12:00:41PM -0800, Dominique Paquin wrote:
> I use a web based application I am making and through this application I
> create directories. I can create the directories with no problem using PHP
> with full rights (777). The directories, then, needs to have their group
> changed to something else and here is my problem,
First off, I hope you're not putting anything important into
world-writable directories :). 

> I tried a chgrp (the php function) from php to change it as well as
> exec('chgrp'...) or exec('chown' ...) and then I tried a system('chgrp'...)
> and system('chown'...). All this to no success. Someone told me, on the
> php.general list, that apache was runing as nobody:nobody, so it had no
*nod*. Apache runs as nobody/nobody by default and, for security
reasons, that's the best way to leave it if you aren't completely sure
you know otherwise.

> rights to change
> rights. We changed the user:group of apache and called it apache:apache.
> then we re-tried all our experiences, to no avail. I am sure I am having all
> the rights necessary because I can delete the directories I create with no
> trouble.
You need to make sure user apache is a member of the group you wish to
chgrp to and, of course, that the destination group actually exists. 
Otherwish you'll get something like the following:

(trb at zero:~%> chgrp qmail zlo-pass
chgrp: you are not a member of group `qmail': Operation not permitted


(trb at zero:~%> chgrp blah zlo-pass
chgrp: invalid group name `blah'

Of course, PHP might not help you out quite like that.

> Any suggestion on how to change rights on directories would be appreciated.
> (With PHP or any other solution)
If that doesn't work you could always hack out a quick perl script to do
the work you need. You probably only need a one-liner.

Best of luck, whichever solution works for you.



Tobyn "trb" Baugher <trb at cartoonviolence.net>
AIM:unlewp ICQ:14281524 EFnet:trb

More information about the thelist mailing list