Problem scenario: You are trying to access a file on a website. But you get the 403 Forbidden error every time. What are some different things to look for to fix this problem?
Solution:
If you do not have access to the back-end of the web server, try these:
- Clear the cache/history from your web browser.
- Clear the cookies from your web browser.
- If you are using wget, try this:
wget -U firefox http://continualintegration.com/
(where continualintegration.com is the URL of the website). - Verify the URL is correct. Have you entered it with correct case sensitivity? Some URLs can be case sensitive.
If you have access to the web server, try these steps:
- Verify that read permissions are given to the user trying to access the file. For example, -r--r--r-- would be the minimum permissions needed. You could use this command: "chmod 644 file.txt" (with no quotes where file.txt is the file you are tryint to retrieve). If the parent directories of the file on the Apache server have strict permissions (at the regular, OS user level on the back end of the server, users on the web front end may encounter the 403 "Forbidden" message in their web browsers or from a wget command.
- Another cause of this problem is the <Directory> </Directory> section of the httpd.conf file could be configured with a "Require all denied" stanza. If this line appears, the DocumentRoot directory will be locked down. That is, no web page will be visible beyond the default "Testing 123" Apache page. To open up the DocumentRoot directory tree, change the "Require all denied" to "Require all granted". This way the Apache server will present a web page to requesters without a "Forbidden" or 403 error. By default, if you install Apache web server and change only the DocumentRoot directory from something besides the default /var/www/html, other references to this very same directory will not be changed. Therefore you need to change those references in httpd.conf. To find httpd.conf, try this Linux command "find / -name httpd.conf" (with no quotes).
- The problem could be intermittent. Read this for more information.