I have created a directory


With the following permissions:

-rw-r--r--. 1 myuser developers

I edited my http.conf:

DocumentRoot "/xyz/www/"
<Directory "/xyz/www/">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all

I get 403 error: You don't have permission to access / on this server.

Looking in the logs:

(13)Permission denied: Can't open directory for index: /xyz/www/

I've tried recursively adding 777 permissions but still have the same issue.

  • 2
    Is SELinux enabled?
    – zero_r
    Jun 6, 2012 at 12:16
  • Yes it is enabled...when I setenforce 0...this fixes the problem!!
    – DD.
    Jun 6, 2012 at 12:35
  • @zero_r can you suggest how to fix this? not familiar with SELinux
    – DD.
    Jun 6, 2012 at 12:39
  • possible duplicate of Permission denied in vhost document root Sep 15, 2012 at 15:21

6 Answers 6


What you have to do is copy the same security context /var/www/html has. To do this:

# ls -la --context /var/www/html
drwxr-xr-x root root system_u:object_r:httpd_sys_content_t .
drwxr-xr-x root root system_u:object_r:httpd_sys_content_t ..
-rw-r--r-- root root user_u:object_r:httpd_sys_content_t index.html

Then you have to set it to your desire DocumentRoot as follows:

# chcon -R system_u:object_r:httpd_sys_content_t /xyz/www
  • I'm not sure how long I would have beaten my head against that problem... thanks!
    – Ben D
    Aug 24, 2017 at 3:43

Is your target directory NTFS or ext3 ? Please check SELinux context of target directory using

ls -a --context /target/directory

If the context of target directory is alike



setsebool -P httpd_use_fusefs on

might work for you as it could be just a boolean issue for the filesystem. Please do confirm the security aspects of Booleans as I'm unaware of them.

SELinux Booleans


Directories normally require the x permission for processes to access files within them. With the permissions you currently have, you would be able to ls the directory but not cd into it. Since the directory is owned by you, Apache will be running with the permissions of the third column.

Try chmod +x /xyz/www.

If you still have problems, check the permissions on /xyz/ as well.

  • even with 777 permissions on all files/directories I still get the same error.
    – DD.
    Jun 6, 2012 at 12:22
  • 1
    The next place I generally look after that is SELinux or Apparmor but it looks like someone already suggested that.
    – Ladadadada
    Jun 6, 2012 at 13:19

I had the same problem - the chcon command fixed it.

I was creating an install server and wanted my images under /export/install/<image> with a symlink in the doc root. I was certain my httpd.conf settings were correct.

The directories & files were 755 & 644 respectively, and the apache user could traverse the tree so what was it?

I used a similar command to the one above but used the reference option:

% chcon -R --reference=/var/www/html /export

Could have just shut off selinux but I want to learn how to live with it.


You should also add <Directory /xyz/www> section to apache config with something like

Order allow,deny
Allow from all
  • Did that already...amended post to add more clarity
    – DD.
    Jun 6, 2012 at 11:41
  • And reloaded httpd ?
    – gelraen
    Jun 6, 2012 at 11:42
  • This is a good point. The default security model of the Apache2 HTTPD server does not allow access to the root filesystem outside of /usr/share and /var/www. Check apache2.conf for this statement: <Directory /> Options FollowSymLinks AllowOverride None Require all denied </Directory> Jan 5, 2018 at 19:12


The 'chcon' command may be used to change SELinux security context of a file or files/directories in a similar way to how 'chown' or 'chmod' may be used to change the ownership or standard file permissions of a file.

chcon -Rv --type=httpd_sys_content_t /xyz/www

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .