Apache (HTTPD); Ownership and File & Directory Permissions: Difference between revisions
Jump to navigation
Jump to search
Created page with "<div class="mw-parser-output">commands</div>" |
No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== The Issue == | |||
...well, it isn't necessarily an issue, but it could be. | |||
For Apache hosted web sites, setting correct ownership and permissions is critical. | |||
== 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. |
Latest revision as of 21:14, 15 February 2018
The Issue
...well, it isn't necessarily an issue, but it could be.
For Apache hosted web sites, setting correct ownership and permissions is critical.
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.