Difference between revisions of "Apache (HTTPD); Ownership and File & Directory Permissions"
Jump to navigation
Jump to search
Line 14: | Line 14: | ||
Directories should have permissions set to 755 | Directories should have permissions set to 755 | ||
find WhatEverFolderName -type d -exec chmod 755 {} \; | find WhatEverFolderName -type d -exec chmod 755 {} \; | ||
The above commands will set ownership and permissions for all files and sub-directories. |
Revision as of 14:13, 15 February 2018
The Issue
...well, it isn't necessarily an issue, but it could be.
Setting 'generic' correct permissions for Apache
Background
I was experimenting with several CMS (Content Management Systems) for web sites and had minor issues here and there getting things to work properly. Sometimes it was PHP or a typo, but most frequently it related to file permissions.
The Solution
In short the ownership of Files for Apache should be set to apache:apache (this is for CentOS 7, for other Linux versions please use the name and group that your web service runs under).
chown -R apache:apache WhatEverDirectoryName
Files should have permissions set to 644
find WhatEverFolderName -type f -exec chmod 644 {} \;
Directories should have permissions set to 755
find WhatEverFolderName -type d -exec chmod 755 {} \;
The above commands will set ownership and permissions for all files and sub-directories.