Take ownership of user folder

4 posts / 0 new
Last post
#1 Wed, 05/21/2008 - 14:18
seba22

Take ownership of user folder

Hmm

In GPL version, files uploaded via php have ownership apahe ;)

Maybye, create script, running dayly from CRON, who take ownership of user homedirectory, drop apache ownership and put user (from name of folder) for owner?

Is this possible ?

Regards

Wed, 05/21/2008 - 14:50
Joe
Joe's picture

Install mod_fcgid (Debian/Ubuntu have it in their repos, and our GPL CentOS 4 and 5 yum repositories also have it). Rebuild Apache to have suexec_docroot set to /home (or install our package--we have them available for Debian 4.0, Ubuntu 8.04, CentOS 4 and 5, otherwise you'll have to rebuild yourself).

Once that's done, add to the VirtualHost section:

SuexecUserGroup "#501" "#501"

Replacing the #501 above with the UID and GID of your virtual server.

Then, in the public_html Directory section:

AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/doxfer/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/doxfer/fcgi-bin/php5.fcgi .php5

Replacing "doxfer" in the above with the home of your virtual server.

Create the directory fcgi-bin in the home directory, and create a file called php5.fcgi, containing the following:

#!/bin/sh
PHPRC=$PWD/../etc/php5
export PHPRC
SCRIPT_FILENAME=$PATH_TRANSLATED
export SCRIPT_FILENAME
exec /usr/bin/php-cgi

Copy /etc/php.ini to the etc/php5 directory within the users home (create the directory, if it doesn't exist, e.g. /home/doxfer/etc/php5/php.ini )

Permissions on the fcgid-wrapper should be 750 and it should be owned by the virtual server user and group.

Ownership of all application files in public_html must be set to the user and group of the virtual server user and group, and permissions must also be 750 or less (anything higher and suexec will refuse to run it).

Restart apache. Cross your fingers. Test.

Check the suexec_log and error_log if anything goes wrong.

--

Check out the forum guidelines!

Sun, 06/07/2009 - 07:22 (Reply to #2)
seba22

Thank, you for response.

Can you tell me, how can I install your build of apache, who have included suexec_docroot.
I'm use, centos 5.

Regards

Thu, 05/22/2008 - 14:45
Joe
Joe's picture

The easiest would be to use yum. You can setup our repositories (including the Webmin stuff, and the binary stuff, in two different repos):

rpm -ivh http://software.virtualmin.com/gpl/centos/5/x86_64/virtualmin-release-1....

Or, you can get the individual packages from:

http://software.virtualmin.com/gpl/centos/5/i386/

http://software.virtualmin.com/gpl/centos/5/x86_64/

We also provide a mod_fcgid package and you'll need mod_ssl from there as well, since it ties very tightly to the httpd version).

--

Check out the forum guidelines!

Topic locked