DSO+mod_ruid2 - PHP still running as 'nobody'

HemanthJ

Member
Feb 28, 2012
9
1
51
cPanel Access Level
Root Administrator
Hi,

I've just used EasyApache to rebuild Apache to include mod_ruid2. But even after setting it as ON PHP scripts are still being executed as nobody.

Details:

WHM 11.34.1 (build 12)
Easy::Apache v3.18.4
Apache 2.2.23
PHP 5.3.22
Configure PHP and suEXEC:

Default PHP Version (.php files) 5
PHP 5 Handler dso
PHP 4 Handler none
Apache suEXEC on
Apache Ruid2 on

The following post came up in searches but it should be fixed in the cPanel version I'm using.

http://forums.cpanel.net/f334/case-52294-support-mod_ruid2-229432-p3.html#post1086201

Please Help. :confused:

Thanks,
Hemanth
 

HemanthJ

Member
Feb 28, 2012
9
1
51
cPanel Access Level
Root Administrator
Thanks for the reply mate.

That is an interesting thought. Whenever I check the Process Manager from WHM, it list ~100 entries like the following:

6042 (Trace) (Kill) nobody 0 0.7 0.4 /usr/local/apache/bin/httpd -k start -DSSL
6555 (Trace) (Kill) nobody 0 0.7 0.2 /usr/local/apache/bin/httpd -k start -DSSL
6478 (Trace) (Kill) nobody 0 0.6 0.2 /usr/local/apache/bin/httpd -k start -DSSL
6497 (Trace) (Kill) nobody 0 0.6 0.2 /usr/local/apache/bin/httpd -k start -DSSL
When I had fcgi+suexec, there used to be a lots of entries by my cpanel username (with command as the php binary).

Is there any way to test if php is being executed as the user or as nobody?
 

KurtN.

Well-Known Member
Jan 29, 2013
95
1
83
cPanel Access Level
Root Administrator
Hi HemanthJ,

If you compiled PHP with the POSIX extension, you can run the following code under one of your virtual hosts:
PHP:
<?php
    $user_info = posix_getpwuid( posix_geteuid() );
    $pid = getmypid();
    printf( "PID:%d, UID:%s (%s)<br>\n", $pid, $user_info['uid'], $user_info['name'] );
?>
 

HemanthJ

Member
Feb 28, 2012
9
1
51
cPanel Access Level
Root Administrator
Thanks Kurt; but that didn't work because I didn't have POSIX.

I found the following simple script which did the job.

PHP:
<?php
echo shell_exec('whoami');
?>
It printed my cPanel username, yay!! :D I hope it prints the process owner rather than the file owner.
 
Last edited:

KurtN.

Well-Known Member
Jan 29, 2013
95
1
83
cPanel Access Level
Root Administrator
Thanks Kurt; but that didn't work because I didn't have POSIX.

I found the following simple script which did the job.

PHP:
<?php
echo shell_exec('whoami');
?>
It printed my cPanel username, yay!! :D I hope it prints the process owner rather than the file owner.
whoami is sufficient for displaying current Effective User of the running process.

PHP functions like get_current_user() and getmyuid() will give you the file information you're referring to.