SOLVED [SOLVED] Owner/group permission issues in public_html

Operating System & Version
11.102.0
cPanel & WHM Version
CentOS v7.9.2009

msklut

Well-Known Member
May 24, 2020
62
5
8
NC
cPanel Access Level
Root Administrator
We are experiencing errors such as "directory does not exist, or has no write permissions" or "Permission denied in /home/adminuser/public_html/system..." or "Permission denied in /home/adminuser/storage/logs...".

Code:
/public_html/
drwxr-x---  18 adminuser nobody   4096 Apr 27 09:59 public_html
drwxr-xr-x  9 adminuser adminuser     4096 Apr 21 11:18 system

/storage/  (located outside public_html)
drwxr-xr-x  12 adminuser adminuser 4096 Mar 31 15:13 storage
drwxrwxrwx  2 adminuser adminuser  4096 Apr 27 10:42 logs
public_html is set to 0750. The others should be 0755 for folders inside public_html and 0644 for files. In order to bypass 'directory does not exist' or 'permission denied' errors, we have temporarily set some folders such as 'logs' to 0777, which presents a big security risk. Does anyone have suggestions? Are there issues with the folder ownership settings?

DEFAULT PHP: ea-php74
ea-php74 SAPI: dso
 
Last edited:

ffeingol

Well-Known Member
PartnerNOC
Nov 9, 2001
765
310
363
cPanel Access Level
DataCenter Provider
It's going to be pretty hard to answer you within knowing what scripting language you are using. If it's PHP, we'd need to know what PHP handler you are using.
 

msklut

Well-Known Member
May 24, 2020
62
5
8
NC
cPanel Access Level
Root Administrator
It's going to be pretty hard to answer you within knowing what scripting language you are using. If it's PHP, we'd need to know what PHP handler you are using.
Code:
[~]# /usr/local/cpanel/bin/rebuild_phpconf --current
DEFAULT PHP: ea-php74
ea-php74 SAPI: dso
 

msklut

Well-Known Member
May 24, 2020
62
5
8
NC
cPanel Access Level
Root Administrator
I use suPHP on my personal box with WordPress and PHP sites to avoid any permissions issues like this, so that's what I'd recommend.
Thank you for the suggestion! suPHP seemed to clear up a lot of the permission issues. Still seeing this one... Any ideas what would be causing it?

Code:
PHP Warning:  fwrite(): supplied resource is not a valid stream resource in /home/adminuser/storage/modification/system/library/log.php on line 31
PHP Warning:  fwrite() expects parameter 1 to be resource, bool given in /home/adminuser/storage/modification/system/library/log.php on line 31

File/folder permissions:

Code:
/storage/
drwxr-xr-x  5 adminuser adminuser  4096 Apr 23 08:15 modification

/storage/modification/
drwxr-xr-x  5 adminuser adminuser 4096 Apr 23 08:15 system

/storage/modification/system/
drwxr-xr-x 5 adminuser adminuser 4096 Apr 25 10:25 library

/storage/modification/system/library
-rw-r--r-- 1 adminuser adminuser  995 Apr 23 08:15 log.php
Line 31 on log.php
Code:
public function write($message) {
        fwrite($this->handle, date('Y-m-d G:i:s') . ' - ' . print_r($message, true) . "\n" . 'URL: ' . (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '') . "\n" . ' REFFER: ' . (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '') . "\n" . '------------------------------------------------------------------------------------------------' . "\n");
 
Last edited: