[HOWTO] mod_ruid2

Well, the permissions seems to me (at least) to be OK.
To be sure, that the user can read the file you could do the following in a root shell:

Code:
# usermod -s /bin/bash webapps
# grep webapps /etc/passwd
webapps:x:501:502::/var/www/html:/bin/bash

(it would enable /bin/bash for the webapps user, we need it temporary to be able to use su)

Code:
# su - webapps -c 'id'
uid=501(webapps) gid=502(webapps) groups=502(webapps)

(here we make sure we can run su to that user)


Code:
# su - webapps -c 'stat /var/www/html/squirrelmail/data/default_pref'
  File: `/var/www/html/squirrelmail/data/default_pref'
  Size: 41              Blocks: 8          IO Block: 4096   regular file
Device: fc02h/64514d    Inode: 141079      Links: 1
Access: (0770/-rwxrwx---)  Uid: (  501/ webapps)   Gid: (  502/ webapps)
Access: 2012-08-14 14:32:44.000000000 +0700
Modify: 2007-02-07 14:59:00.000000000 +0600
Change: 2012-08-24 13:27:25.000000000 +0700

(here we check whether the user can read the file)

Code:
# usermod -s /bin/false webapps

(here we change back temporary allowed shell access for webapps user)

If the user webapps is allowed to access the file, and there is NO system level restrictions, then I'd say your apache is miss-configured.
 
Last edited:
you could do the following in a root shell:

Code:
# usermod -s /bin/bash webapps

[code]# su - webapps -c 'stat /var/www/html/squirrelmail/data/default_pref'
  File: `/var/www/html/squirrelmail/data/default_pref'
  Size: 41              Blocks: 8          IO Block: 4096   regular file
Device: fc02h/64514d    Inode: 141079      Links: 1
Access: (0770/-rwxrwx---)  Uid: (  501/ webapps)   Gid: (  502/ webapps)
Access: 2012-08-14 14:32:44.000000000 +0700
Modify: 2007-02-07 14:59:00.000000000 +0600
Change: 2012-08-24 13:27:25.000000000 +0700

(here we check whether the user can read the file)

Code:
# usermod -s /bin/false webapps

(here we change back temporary allowed shell access for webapps user)

If the user webapps is allowed to access the file, and there is NO system level restrictions, then I'd say your apache is miss-configured.

Thank again.
I tried codes, problem not solved. and not sure about result:
Code:
[root@ser ~]# usermod -s /bin/bash webapps
usermod: no changes

Code:
[root@ser ~]# su - webapps -c 'stat /var/www/html/squirrelmail/data/default_pref                   '
  File: `/var/www/html/squirrelmail/data/default_pref'
  Size: 41              Blocks: 8          IO Block: 4096   regular file
Device: fd02h/64770d    Inode: 11539047    Links: 1
Access: (0770/-rwxrwx---)  Uid: (  501/ webapps)   Gid: (  502/ webapps)
Access: 2013-03-02 15:27:45.047978103 +0330
Modify: 2007-02-07 12:29:00.000000000 +0330
Change: 2013-03-06 15:11:01.278986859 +0330
If you think problem is apachi, is there any solution?
 
Which of the installations for mod_ruid2 are correct? There is one here http://wiki.amservers.nl/Mod_ruid2 which mentions that you need to recompile php with --disable-posix. Also, there is no mention of vhost files to custom/. Does this mean that this is a newer version of mod_ruid2 installation on DA?

The OP mentions nothing about recompiling php but he talks about copying files to custom/

So which of the 2 is correct? Its very confusing. I followed http://wiki.amservers.nl/Mod_ruid2 but i seem to have a problem. I still have to chmod 777 directories. Does this mean the OP's post is the one we should be following? Very confusing.
 
I wrote the article on http://wiki.amservers.nl/Mod_ruid2

It should be the best way to install mod_ruid2 if you run custombuild 1.2 (it is still the latest stable). Only if you have Custombuild 2.0 you don't have to follow any guide here, it has it included.

I recommend recompiling php with that posix line for extra safety. It is not mandatory for mod_ruid2 to work.

You don't need to copy the vhost files, DA already has the mod_ruid2 modifications in the vhost files by default (it also says that in the article :))
 
The directadmin templates changed much since the HowTo were written, for now if you use CB.2 you don't need to follow the guide, just set:

Code:
./build set mod_ruid2 yes
./build set php1_release mod_php

and build php.
 
I wrote the article on http://wiki.amservers.nl/Mod_ruid2

It should be the best way to install mod_ruid2 if you run custombuild 1.2 (it is still the latest stable). Only if you have Custombuild 2.0 you don't have to follow any guide here, it has it included.

I recommend recompiling php with that posix line for extra safety. It is not mandatory for mod_ruid2 to work.

You don't need to copy the vhost files, DA already has the mod_ruid2 modifications in the vhost files by default (it also says that in the article :))

Ok but i still have to chmod 777 3 of my WHMCS directories even though i followed your howto.
 
The directadmin templates changed much since the HowTo were written, for now if you use CB.2 you don't need to follow the guide, just set:

Code:
./build set mod_ruid2 yes
./build set php1_release mod_php

and build php.

Iv already installed it manually. Does this mean i have to undo all the mods to run it from CB2.0?
 
Have you tried the test php script in the article? That way you can tell if it is working.

Also if the whmcs was already installed before you installed mod_ruid2 you may have to reset the file owner permissions. See 'Converting an existing envoirment'
 
Permissions Error
The templates compiling directory 'templates_c' must be writeable (CHMOD 777) before you can continue.
If the path shown is incorrect, you can update it in the configuration.php file.

If mod_ruid2 is working i should not be getting the above error.

Not sure what you mean about file perms. All php is 0644, directories are 755 and those 3 that should be 777 can now be 755.

The test works fine. Something else is not working here. Can anyone verify that directories that used to require 777 can now be chmod 755?
 
i did have same issue with whmcs.. i think whmcs installer or updated do this changes, but reverting back to 755 to me did work and whmcs doenst complain

Regards
 
The directadmin templates changed much since the HowTo were written, for now if you use CB.2 you don't need to follow the guide, just set:

Code:
./build set mod_ruid2 yes
./build set php1_release mod_php

and build php.

Alex, are you sure about the templates?

In virtual_host2.conf i see this

</IfModule>
|*if HAVE_RUID2="1"|
<IfModule mod_ruid2.c>
RMode config
RUidGid |USER| |GROUP|
RGroups apache |SECURE_ACCESS_GROUP|
</IfModule>

But thats not what i see in my current installation. For one user i see this;

<IfModule !mod_ruid2.c>
SuexecUserGroup wpliv4co wpliv4co
</IfModule>

Which means its vastly different.
 
That is the major feature of it, 777 should not be necessary. But if your whmcs files are currently not owned by the DA user but instead apache for example, it would still need 777. So check if the file owner/group is the DA username. If not you need to make the owner/group the DA user. You can do that with the commands listed under 'Converting an existing envoirment' at the wiki.

Also WHMCS may be buggy in not recognizing if it actually has writing rights rather then checking other factors.
 
i did have same issue with whmcs.. i think whmcs installer or updated do this changes, but reverting back to 755 to me did work and whmcs doenst complain

Regards

Im not running updater or installer. I just moved the 3 directories back under public_html and set the directories to 755. It fails. It wants to see 777. So whats the point of mod_ruid2? I mean, i could uninstall it and move the 3 directories out of the virtual host space to secure them. But that defeats the purpose of what mod_ruid2 is suppose to do doesnt it?
 
That is the major feature of it, 777 should not be necessary. But if your whmcs files are currently not owned by the DA user but instead apache for example, it would still need 777. So check if the file owner/group is the DA username. If not you need to make the owner/group the DA user. You can do that with the commands listed under 'Converting an existing envoirment' at the wiki.

Also WHMCS may be buggy in not recognizing if it actually has writing rights rather then checking other factors.

all my files are user:user including directories.

home/mydirectory is user:access and so on.
 
That is odd. But if the php test worked and it created a dir and file in it, that means that mod_ruid2 is working. Without mod_ruid2 this wouldn't work.

Other than that it could either be a certain folder you may have missed or else it needs to be whmcs just not being coded correctly -- however there should be many people using whmcs+mod_ruid2.
 
I guess to test if its really working or not i should try to upload an image file to a wp installation with the uploads directory chmod to 755. That would ultimate tell me if mod_ruid2 is working.
 
Nope it wants 777 on the upload directory. I think ill have to remove this bloody thing. All my themes are missing from all my wordpress installations. Says "your theme seems to be missing from your installation" please investigate. yet when i look the theme directory is there and the pages load fine. But in the wp editor it cant find the wp themes.
 
All my customers that use wordpress have no this issue for sure.

We dont need to do any investigation, probably something is not correctly set in your installation.

Also, we do not manage mod_ruid2 development, so, i dont see what "we" should check.

Regards
 
Back
Top