Apache runs as "nobody" for non cpanel users... how to change this?

Operating System & Version
almalinux 8.4
cPanel & WHM Version
100

Jintor

Member
Jul 14, 2021
12
0
1
Canada
cPanel Access Level
Root Administrator
Hi,

CONTEXT 1 : I need apache to run as the cpanel user

CONTEXT 2 : I need to do some shell_exec('ssh user@remotepi....')

CONTEXT 3 : Cloudflare Argo tunnel is installed on 1 domain => this domain makes apache run as 'nobody'

DETAILS :
For all my domains (except 1) : when I do shell_exec('whoami'); => I get the cpanel user related to the domain.
I installed the apache mod_ruid2 => domain x => apache runs as cpanel user x, domain y => apache runs as cpanel user y,

I need to perform shell_exec with ssh [email protected].....

the user "nobody" don't have a .ssh

I followed the instructions on this page https://developers.cloudflare.com/c...s/connect-apps/install-and-setup/tunnel-guide

Since I did this, any requests from a normal browser => goes to cloudflare => argo stuff => hit the /var/www/html => apache runs as "nobody"

QUESTION 1 : how do I change the default user for apache to run (for domains that dont have a related cpanel user) ?
OR QUESTION 2 : how can I configure cloudflare argo to "run" as a cpanel user ???
 

cPanelAnthony

Administrator
Staff member
Oct 18, 2021
1,041
112
118
Houston, TX
cPanel Access Level
Root Administrator
Hello! It sounds like an issue of PHP handlers.


The CGI handler executes PHP applications through the mod_cgi or the mod_cgid Apache modules. If you install the suEXEC module, the system executes PHP applications as the user that owns the VirtualHost that served the request. If you uninstall the suEXEC module, the system executes PHP applications as the nobody system user. The system provides mod_cgi and mod_ruid2 by default.

DSO
  • Unless you use a per-user module such as Ruid2 or ITK, your PHP scripts must have permissions of at least 0644 to execute. The PHP scripts that run under DSO create files as the nobody user. The nobody user must have sufficient permissions to access and read the PHP files and permissions to write to the files and directories that the script affects.
Are you using DSO by chance? I would suggest reviewing this documentation and ensuring your PHP setup is configured for scripts to execute as the cPanel user.
 
Last edited: