Runing a php script as the FTP user, or grant php user r/w privileges with inheritance
Posted on 2004-08-28
let me tell you what I'm trying to do, what I've tried already...
I have a php script that accesses a folder named content where some
persons will be uploading image galleries. The script does read the
html files and makes some changes.
All this works fine when run in a windows box with apache + php, as
there is no problem with the permissions.
What I do need:
. I would like apache run the php script as the FTP user. So it has the same privileges, an
if it creates a new file, the ftp user will be able to delete it without
having to make the file world writable.
. another way of doing so, would be grant the "www" user to r/w any files/folders untder
that "content" folder. This also includes newly created ones by the FTP user.
A not so ellegant sollution, would be change the FTP daemon defaul folder and file
permission, so it's wold readble & writable... But this is not my prefered sollution.
I have tried already creating a folder from a php script and do a chmod ("folder", 01755); so the owner is "www".
Also tried the chmod ("folder", 04777); and lots of variants, but seems that the setuid and stiky bits
have no real effect, as when the ftp user creates a new folder under the "content" folder, the "www" user
(the one that runs for apache) has no write rights on that folder.
Something like giving "root" privileges to the "www" user, is not my preferred sollution...
the server is a FreeBSD 4.9 with Apache/1.3.29 and PHP 4.3.4
I hope everything about what I do ask is quite clear here, if there's something uncler, I will be more than willing to clarify.
Thanks a lot in advance!