Re: PHP User Permissions

From: Date: Fri, 11 Feb 2005 16:32:54 +0000
Subject: Re: PHP User Permissions
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-208572@lists.php.net to get a copy of this message
Matthew Walker wrote:
And if you're running apache as root, you shouldn't be allowed to. Apache should always be run as as nonpriviledged user. On Fri, 2002-09-13 at 09:04, J Smith wrote:
A running script cannot change its own permissions
If you mean can't change it's user ID and/or group ID, that isn't entirely true. If your script is being run as a privileged user on a UNIX system (usually root), you can change the user/group IDs of the process (either effective or real) with the POSIX extension. (posix_seteuid(), posix_setuid(), etc.) I haven't tried it from an Apache process, so I can't say if it will work from a web server (doubtful) but it does work for standalone scripts from the CGI/CLI.
AFAIK, your CGI is processed by a child process of apache, that should run as an unpriviledged user, so it cannot change the U/GID.

« previous php.general (#208572) next »