In the configuration I have setup I wish to allow samba and apache to access /var/www
I am able to set a context to allow samba access, but then httpd doesn't have access.
Using setenforce to 0 eliminates issues so I know that it is SELinux.
In addition:
How can I view the context of a folder, and can a folder have multiple contexts?
(CentOS)
Best Answer
First off, you can view the context of something with ls using ls -Z
Second, there are two options for giving Samba and Apache access to the same directory.
The simple way is to just allow samba read/write access everywhere with:
It's simple, easy, and doesn't mess with any weird properties of SELinux.
If you're concerned with Samba having full access to all directories and only want to change /var/www, try:
This will allow both Samba and Apache write access to any directories with the public_content_rw_t context. Note that chcon is only modifying /var/www. Any new directories created under /var/www will be public_content_rw_t, but not existing directories like /var/www/html or /var/www/manual. If you want to change everything, add an -R to chcon:
You can look through this CentOS wiki page to get hints on other SELinux booleans.