Gordon Hickley
Gordon Hickley

Reputation: 491

PHP user as member of a group cannot write to a folder

Server is Cento7 running Nginx & PHP. I run Nginx and PHP-FPM as user nginx. nginx is a member of a group called webmasters.

My website is at /var/www/production/site/

Owner of /var/www/production/site/ is other_user:webmasters. Permissions are 0775 These are both applied to all subfolders.

A php script calls file_put_contents() but gets 'permission denied' as it attempts to write to a subfolder.

If I change the owner of /var/www/production/site/ to nginx:webmasters I do not get permission denied.

SELinux is disabled.

So as a member of a group with RWX it cannot write. Any suggestions?

Upvotes: 0

Views: 138

Answers (1)

Nigel Ren
Nigel Ren

Reputation: 57121

If you want a member of the group to be able to write to it, it will need to be 775. 755 is rwxr-xr-x, which means that owner can do anything, but the group can read but not write to it. 775 is rwxrwxr-x which just stops anyone outside user or group writing to it.

Upvotes: 1

Related Questions