Websites report permission errors when trying to write/modify files

Operating System & Version
CentOS 7.9.2009
cPanel & WHM Version
102.08

kon33

Member
Mar 25, 2022
8
1
3
Earth
cPanel Access Level
Root Administrator
Hello,

I'm currently at 102.08 under CentOS 7.9.2009.

I'm having trouble with websites that use Wordpress, where they do not seem to able to write or modify existing files. I've been troubleshooting it, and the only way I managed to get things to work was to change the ownership of the whole directory tree (~/public_html/wp-content/uploads) to "username:nobody" and changing the permissions to 770. The files created in this form are always owned by nobody:nobody and with 660 permissions. Any other combination I've tried hasn't worked.

I found the following post that mentions a very similar issue, but it's related to PHP-FPM and it being disabled after an upgrade. My system currently has PHP-FPM enabled on all domains, so this didn't fix the issue for me.


Is there anything else I can try?
 

kon33

Member
Mar 25, 2022
8
1
3
Earth
cPanel Access Level
Root Administrator
No, sorry, my bad. I meant files created by any upload mechanism while the directory tree's permissions are on 770 with "username:nobody" ownership, including media files through Wordpress.

If I leave the website with default permissions (650 for files, 750 for directories) and ownership (username:username) the files aren't uploaded, and I get an error message saying it has no write permissions.
 

kon33

Member
Mar 25, 2022
8
1
3
Earth
cPanel Access Level
Root Administrator
Just tried changing the whole tree and files within it to the permissions and ownership you mentioned, it's now failing again with permission errors.

Is the public_html directory also supposed to be username:username? I just tried both ways (while the rest of the files remained as username:username and 644/755) and it still won't work.
 

quietFinn

Well-Known Member
Feb 4, 2006
2,109
580
493
Finland
cPanel Access Level
Root Administrator
public_html should be username:nobody, with permissions 750.
 
Last edited:

quietFinn

Well-Known Member
Feb 4, 2006
2,109
580
493
Finland
cPanel Access Level
Root Administrator
In the same page where you set the default PHP version and PHP-FPM you have list of PHP Handlers.


phphandlers.jpg
 

kon33

Member
Mar 25, 2022
8
1
3
Earth
cPanel Access Level
Root Administrator
In the same page where you set the default PHP version and PHP-FPM you have list of PHP Handlers.
Interesting. They all are on "cgi", no other PHP Handlers are installed (I'm guessing this is the reason I'm having this problem).

I see in your screenshot you have suphp. Is this provided by mod_suphp?
 

quietFinn

Well-Known Member
Feb 4, 2006
2,109
580
493
Finland
cPanel Access Level
Root Administrator
Interesting. They all are on "cgi", no other PHP Handlers are installed (I'm guessing this is the reason I'm having this problem).

I see in your screenshot you have suphp. Is this provided by mod_suphp?
If you read here:

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.

So yes, cgi without suEXEC is the problem.

EDIT - added this:
Yes, suPHP Is provided by mod_suphp
 
Last edited:
  • Like
Reactions: cPRex