Author Topic: Forks run as nobody - but scripts can't see anything  (Read 7640 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Forks run as nobody - but scripts can't see anything
« on: November 01, 2015, 02:43:39 PM »
Hello there,

I am installing this piece of software for my client, and he wants to use CentOS Web Panel, which I must admit - looks better than at first I was hoping it to be.

We're having this issue, where the PHP/BASH software is always failing due to:
wget: command not found
ls: command not found
etc..

Since the server is working well, I begun to go after HTTPD processes.

Code: [Select]
[root@server ~]#  cat /etc/redhat-release
CentOS release 6.7 (Final)

Code: [Select]
[root@server ~]# ps faux | grep httpd
root     31870  0.0  0.0 103356   856 pts/0    S+   09:35   0:00          \_ grep httpd
root      9332  0.0  0.0  59168  3684 ?        Ss   07:26   0:00 /usr/local/apache/bin/httpd
nobody   17413  0.0  0.0  59536  3472 ?        S    08:25   0:00  \_ /usr/local/apache/bin/httpd
[root@server ~]#

So httpd forks run as nobody, okay. So I checked if nobody sees linux paths.

Code: [Select]
[root@server ~]# su nobody -s /bin/bash
bash-4.1$ wget
wget: missing URL

Code: [Select]
[root@server ~]# su nobody -s /bin/bash
bash-4.1$ echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
bash-4.1$


So the user 'nobody' seems okay in itself. So this problem is somewhere between PHP and the interfacing with the Linux user.

I tried to use:

Code: [Select]
<?php
print shell_exec'whoami' );
?>

But the window is empty, same command works well on any other server and returns the active user.

Additionally, if we override the scripts, by setting a PATH variable in the script, commands such as wget are found, but ls and $HOME paths seem loose info somewhere.

Code: [Select]
if [ "$(ls -I '^.' $HOME/$tpl_file_path)" == "" ]
When ran via the browser - it gets a false, i.e. no files exist in the folder. If we do this from the nobody user - it returns a proper dir listing (with files existing)


Anybody could give some tips on what to do? Been working on this for 3 hours with no further results. PHP Info is here: http://tinyurl.com/pgft6mo
Cheers.

« Last Edit: November 01, 2015, 03:07:36 PM by Yukinarija »

Offline
*
Re: Forks run as nobody - but scripts can't see anything
« Reply #1 on: November 02, 2015, 02:59:49 PM »
Also, I would like to add that the scripts themselves are bash scripts, example names are:

CreateServer

(without .sh at the end).

These are started by the web server from a php based website.


Offline
*****
Re: Forks run as nobody - but scripts can't see anything
« Reply #2 on: November 03, 2015, 09:04:23 AM »
Hello.

In the file:
Code: [Select]
/usr/local/etc/suphp.confchange the line:
Code: [Select]
env_path=/bin:/usr/bin:/usr/local/php/binto:
Code: [Select]
env_path="/bin:/usr/bin:/usr/local/php/bin"
It should help to you.
You can ask me to solve any problem with your server for some money in pm  ;)
Services Monitoring & RBL Monitoring
http://centos-webpanel.com/services-monitor
Join our Development Team and get paid !
http://centos-webpanel.com/develope-modules-for-cwp

Installation Instructions
http://centos-webpanel.com/installation-instructions
Get Fast Support Here
http://centos-webpanel.com/support-services

Offline
*
Re: Forks run as nobody - but scripts can't see anything
« Reply #3 on: November 03, 2015, 09:50:51 PM »
Hello Igor,

This seems to made it work!
Could you please elaborate? What was the issue in suPHP? How did those quotes help out and how did you know?

Either I am too tired to figure it out, or its a bit tricky.