403 Forbidden you dont have permission to access on this server

Home > Search
  by

When attempting to access a web page from a web server, if message 403 Forbidden you don't have permission to access on this server appears, there may be an issue with permissions to the web server files.

 


Permissions

The minimal permission needed to view the web files are r--r--r-- (read only).

~]# ll /var/www/html
-r--r--r-- 1 root root 1473 Dec 29 02:44 index.html

 


SELinux

Use the ls -lZ command to view the SELinux permissions on the web files. Apache needs the type to be httpd_sys_content_t.

~]# ls -lZ /var/www/html
-r--r--r-- 1 root root unconfined_u:object_r:httpd_sys_content_t:s0 index.html

 

If the type is ot httpd_sys_content_t, restore the context.

~]# restorecon -Rv /var/www/html

 


Configuration

Check the server configuration file (eg. httpd.conf). Check to see if the directory being requested is granted.

<Directory />
  Require all granted
</Directory>

 

There may also be other lines in the server configuration file that need to be adjusted. For example, if a required include is commented out, that may cause 403.

# Include /path/to/file

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments