If you are running apache, I believe it runs as user apache, or as nobody.... you could in theory, make the php script setuid and run as someone with permission to write to the directory. However, this is pretty glaring security risk, but if you keep it contained, it shouldn't be too big of a problem.... I think though, that newer versions of *nix prohibit setuid on scripts (though, it might just be setuid to root on scripts.. which you should never do anywhere, but not sure).
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
Do you mean that you can't write files in directories you created with the shell? What exact permissions are the files at before you chmod them? 755 permission means read/write/execute for owner, and read/execute for everyone else, which must mean that the owner of the files/directories is the same user that's running apache...
>I think though, that newer versions of *nix prohibit setuid on scripts
>(though, it might just be setuid to root on scripts.. which you should
>never do anywhere, but not sure).
Yeah, virtually all versions of *nix prohibit setuid on shell scripts globally, and for all users, not just root.
John A
Vampirical Lurker
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339
Well, what's the owner of the directory you're trying to write to, and what are its permissions? I suppose you could just set the directory's permissions to 777 and that should pretty well take care of any permission issues with regards to creating new files.
However, it's worth pointing out that files/directories set to 777 are readable, writable, and executable by all users on the system, so if that's a concern, you might want to consider changing the owner of the directory to the one that apache is set to run as and setting it to 755, which will ensure that only apache can write to the directory.
John A
Vampirical Lurker
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339