This is based on my CentOS server with Apache 2.x.

Installing this module its no longer needed to chmod config files to 666 or upload/attachments directories to 777. Since with this module enabled everything at HTTP will run under the user itself and not ‘apache’ anymore.

** If you are using mod_ruid instead of mod_ruid2, first of all remove the mod_ruid line from ‘/etc/httpd/conf/httpd.conf’

First, we are going to install libcap-devel

   

After this is done we are going to download and install mod_ruid2

Now, if you didn’t get any errors mod_ruid2 should be installed and added to the ‘/etc/httpd/conf/httpd.conf’.

Lets confirm mod_ruid2 is added

If you get any response like below its installed

Now we need to modify the DA httpd.conf templates a little bit to enable mod_ruid2 for the users

Now copy the template files to custom

Now you have copied the original templates to the ‘custom’ directory, so they won’t be overwritten.

Now follow the steps below for each virtual_host2 file you’ve copied

replace line:

with:

Add the lines below under the just replaced line

Save the files and lets rewrite the HTTPd config files

If you want you can start the rewrite of the HTTPd config files manually, just paste the line below and wait when its done

After the rewrite is complete you can restart HTTPd with the command below

Now mod_ruid2 should be installed and you don’t need to chmod anymore like ‘chmod 666 config.php’ or ‘chmod 777 uploads’.

To be sure the webmail clients etc still works we need to change the owner permissions

And last you need to modify httpd-directories.conf

 Add the RUidGid line below between the and

 

Q: How can I test this is working?
A: Easy, install some CMS that you are used before. Like WordPress, Joomla that required (before!!) chmod 666 or 777 to get install/working.

Q: I’ve dirs/files owned by apache for some users, must I change this?
A: Yes, you need to give the dirs/files owner of the user itself, not apache anymore. Check below

To fix the owner permissions of the dirs/files

    * Added ‘&&’ so if they do a typo, it won’t change anything.

Finally, if you have problem with perl it should be root:root and not root:apache: