Appache to access user home directories

Table of Contents


  • How to enable appache to access user home directories?

  • How to use SELinux Booleans to control appache to access user home directories?


  • Make sure Apache web server are installed correctly

# systemctl status  httpd
  • Enable the Apache feature that permits users to publish web content from their home directories

# vim /etc/httpd/conf.d/userdir.conf
# grep '^ *UserDir' /etc/httpd/conf.d/userdir.conf
    UserDir public_html
  • Restart httpd

# systemctl restart httpd
  • Create some web content that is published from a user’s home directory.

$ mkdir ~/public_html
$ echo 'SUCCESS' > ./public_html/ping
$ chmod 711 ~
  • Access web content ping

# curl
<title>403 Forbidden</title>
<p>You don't have permission to access /~kylin/ping
on this server.</p>
  • use the getsebool command to see if there are any Booleans that restrict access to home directories

# getsebool -a | grep home
  • Use setsebool to enable home directory access persistently.

# setsebool -P httpd_enable_homedirs on
  • Access web content ping

# curl

results matching ""

    No results matching ""