UID/GID Problem

berko

New member
Joined
Oct 9, 2005
Messages
1
Hi!!!
When I tranfert some file on my server, I can see UID and GID named "cortaclub" (name of my domaine site).
I've got some php script who, when I execute them, genered some new file (like photo.php genered a folder thrumbnail with a file info_gallery.php).
My problem is that this folders and files have a UID and GID call "apache", and when I want to change permission, I've got an error like this "Unable to set file permissions, Unable to chmod /dom/cortaclub.ch/public/sm-mdbfe.rar"
Could anyone help me???

Thanks
 
What you have explained doesn't look like a directadmin issue, it even looks like you aren't using it at all.

Though your error can be fixed by using php script to change either the owner or the file permisions as it will run as the the user `apache`

This forum as a whole is used to discuss directadmin and problems people are having with directadmin and apache, rather than just apache.
 
ozcorp said:
What you have explained doesn't look like a directadmin issue,
That's correct. It's an issue of how PHP works with apache.
it even looks like you aren't using it at all.
Nope. This will occur with DirectAdmin, and without DirectAdmin. It has nothing to do with with DirectAdmin. Nevertheless, since it's about how apache operates, I'm leaving it in the "Apache (WWW)" forum.
Though your error can be fixed by using php script to change either the owner or the file permisions as it will run as the the user `apache`
Nope. since PHP runs as apache, it doesn't have the rights necessary to change the ownership to anything else.
This forum as a whole is used to discuss directadmin and problems people are having with directadmin and apache, rather than just apache.
But it's probably not too terrible to point out that it's just part of how PHP/apache work, and if the original poster needs to do something that can't be done s/he would be best served by finding another way to address the problem.

The way we addressed it was to run a cronjob as root every X minutes to change ownership of specific directories. This may or may not work for the poster.

Jeff
 
berko said:
My problem is that this folders and files have a UID and GID call "apache"
Perfectly normal, since PHP runs as user apache, group apache. There's no easy way to get it to do otherwise.
, and when I want to change permission, I've got an error like this "Unable to set file permissions, Unable to chmod /dom/cortaclub.ch/public/sm-mdbfe.rar"
Could anyone help me???
What do you want the username/groupname to be, and why?

Jeff
 
After creating a file (or image) on the fly, php creates the file with UID/GID apache.

No problem with that, but maybe users don't like that because they don't have the rights for FTP. They can create the file, but can't delete them :-)

you can use the php delete file command unlink
unlink("filename");

chown via php exec is not possible because apache doesn't have the rights to switch the UID/GID. Or does it? (i always use root for moving UID/GID's).

In case i am wrong, try:
$file=fullpathofthefile;
exec("chown newuser:newgroup $file");

Greetz,

Franky
 
Franky,

You are correct. Only root and apache can change the UID/GID of the file.

Jeff
 
Back
Top