I am trying to make a script to write files to a directory with the CHMOD of 0775. When I created the directory using an FTP program and uploded the script, both the script and the directory have the same exact user and group. However, the script runs as a different user and group (ie. probably the apache server or www or somesuch. I have the UserID and GroupID of what it runs as, which is not the userID and GroupID that the script is saved on the server as).
However, when I try to write a file to the directory, I get an error in the browser that permission is denied.
I can, however, write to the directory if the CHMOD is 0777. But I do not want to open the directory up to the public like this.
I haven't got access to the server-side configurations. So I have to do things strictly in PHP for this particular task. Safe Mode is ON on this particular server.
Does anyone know of php code that lets me write to a directory that is owner+group-writeable only?
How do I write to a group-writable directory?
Moderator: General Moderators
-
FuzzieDice
- Forum Newbie
- Posts: 4
- Joined: Wed Sep 19, 2007 3:04 pm
-
FuzzieDice
- Forum Newbie
- Posts: 4
- Joined: Wed Sep 19, 2007 3:04 pm
Hmmm... Ok. I was hoping for a way to use a folder to write files in a way that only the script can write to that folder, and nobody else.
I even thought of trying to CHOMOD the folder (within the php script) to public writable just long enough to write to it than CHMOD it back. Problem is, it wouldn't CHMOD the folder to 0777 in the first place.
I was hoping for a way to have a folder I could write to, and yet so that hackers could not put their scripts in there and pretty much see all the files on the server (like I've seen happen with Joomla, Coppermine, phpBB, etc.)
I even thought of trying to CHOMOD the folder (within the php script) to public writable just long enough to write to it than CHMOD it back. Problem is, it wouldn't CHMOD the folder to 0777 in the first place.
I was hoping for a way to have a folder I could write to, and yet so that hackers could not put their scripts in there and pretty much see all the files on the server (like I've seen happen with Joomla, Coppermine, phpBB, etc.)