user99999
user99999

Reputation: 2024

Nginx can't create files inside 755 permissions folder

I have a folder with 755 permissions with foo-bar:foo-bar chown. Nginx throws an error that it can't save a file inside it, it only can when I change the folder's recursive permissions to 777. How can I allow nginx to create the files inside this folder with 755 permissions?

My user groups:

foo-bar: foo-bar www-data
www-data: www-data

Should I just add www-data to foo-bar group? Will this work? Or is it better to do something else?

Upvotes: 1

Views: 2117

Answers (1)

Janek
Janek

Reputation: 3242

Permission 755 can be translated to rwxr-xr-x, meaning the owner can read, write and open (eXecute) the folder, the group and "others" can only read and open. If nginx is running as www-data it won't be able to write to the folder unless you change the permissions to 777.

If you add www-data to foo-bar group you will still have to set the permission to 775 for the group members to be able to write to the folder.

Upvotes: 1

Related Questions