Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Security and Permissions vs UID

Status
Not open for further replies.

vesselescape

IS-IT--Management
Feb 17, 2002
100
US
Looking for some feedback (General Discussion) to try and resolve a security issue on our remote (virtual) webserver.

*nux box running Apache (latest) with PHP 4.2.2 Located on remote webserver.

PHP admin interface designed to allow authorized (password and username hard coded in php) users to upload photos to server.
As part of upload, the upload directory is created via php code based on info contained in a mysql db (related to a given record) Related graphics files and directory created are both deleted if record contained in db is deleted via php admin interface. All works well.

Here is the rub. If the files are uploaded with chmod of 755
the admin interface works great. But the webmaster cannot modify or delete the files directly via ftp, or ssh telnet as the uid for the files uploaded by php and the uid for the webmaster accessing the server via ftp (or telnet) do no match. Ergo, access denied when trying to chmod or unlink the files or directories directly. At least, this is what we think is happening. If the files are uploaded via php (and directories created) as chmod 777 Webmaster can do whatever he wants, but so could anyone else with access to the server.

The code is too much to upload here for specific answers, what I hope for is a general discussion as to how to deal with this question, maybe a glaring error we are making in our assumptions, or anything else that may get the light bulb to come on.

Have read the disussions and factoids in the php_man re: safe_ mode (off in our case) chmod, uploads. and anything else that seems to relate. Being more of a network admin type rather than a php weenie. I am hoping you all can shed some new light on the question.

Will keep a close eye on the thread, and provide anymore info you might require for further discussion.

Thanks,
David ONeill
 
Why not make the webmaster a member of the group which owns the files? ______________________________________________________________________
TANSTAAFL!
 
If the server was on the local network, rather than leased from an isp, this would be no problem. This is not the case however, and therein lies the basis of the situation. Question is how to get php when running as an apache mod to give up ownership of a file/directory that it creates during upload.

Regard,
David
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top