Re: User question for PHP
| From: | Chris | Date: | Fri, 20 Oct 2006 05:49:14 +0000 |
| Subject: | Re: User question for PHP | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-243369@lists.php.net to get a copy of this message | ||
Andy Hultgren wrote:
To whoever was asking this (sorry didn't see the original email):Actually you have that the wrong way around. If php is running as "www" or "nobody" then any files or directories that a php script creates will be done as the web server user. That means (potentially) that if domain 'a' creates a file, domain 'b' can read and write to that file and even delete it. If php is running as you instead, you can control this with appropriate chmod commands (at least removing the risk of deleting of files / updating of files). A shared user (like "www" or "nobody") is a *much* bigger risk than separate users. -- Postgresql & php tutorials http://www.designmagick.com/I was recently exchanging on this list about that very topic. It's in the archives for this list. Go to www.php.net and set the dropdown menu in the upper right corner of the page to "general mailing list", then type "File Upload Security and chmod" into the search field and hit enter. The conversation is within the first few hits on this search. The server hosting my site runs with php executing as "me" (the owner of the domain), and we covered some of the potential security pitfalls of such a situation (mainly centered on the fact that this makes any php script far too powerful). In my situation I couldn't change how the server was set up; however, the general consensus was that this situation created a number of serious security concerns that had to be very carefully addressed. I would avoid this configuration if you have the choice, based purely on the advice I received.Is it possible to have a PHP script execute as the user of the domain instead of the webserver? So when I upload files through a PHP script they are owned by me and not "wwwrun" or "nobody"?