Book Image

SELinux Cookbook

By : Sven Vermeulen
Book Image

SELinux Cookbook

By: Sven Vermeulen

Overview of this book

Table of Contents (17 chapters)
SELinux Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Enabling user directory support


Let's look at an example of how to use SELinux Booleans applicable to web server installations. In this recipe, we'll enable Apache UserDir support (allowing the web server to serve local user account web pages at http://sitename/~username).

Getting ready

Configure the Apache web server to serve user content. An entire Apache configuration tutorial would be in place here, but this is not in the scope of this book. Basically, this is done by editing the httpd.conf file and setting the UserDir directive.

How to do it…

To enable user directory support, follow the next set of steps:

  1. Make sure that the user's home directory is accessible for the Apache runtime account with the following commands. If Linux DAC denies access, SELinux will not even handle the request.

    ~$ chmod 755 ${HOME}/
    ~$ chmod 755 ${HOME}/public_html
    
  2. Check that access isn't already allowed by surfing to a user page. If all permissions are okay but SELinux denies access, then the page should be served...