I have a folder name public that I set up Apache to serve files out of, for some reason I was getting a 403 with the error message:

You don't have permission to access / on this server.

My solution was to create another folder (test) alongside it and use that to serve files out of.

What I don't understand is why if the permissions, as far as I can tell are identical between the two folders, yet using the first folder gives me permission errors.

How can I diagnose this further?

ls -l gives:

drwxrwxr-x 2 daniel daniel 4096 Apr 26 19:10 public
drwxrwxr-x 2 daniel daniel 4096 Apr 26 19:10 test


Contents of /etc/apache2/sites-available/000-default.conf

<VirtualHost *:80>
    DocumentRoot /home/daniel/public/default/public/
    DirectoryIndex index.html index.php
    LogLevel warn
    ErrorLog /home/daniel/public/default/log/error.log
    CustomLog /home/daniel/public/default/log/access.log combined

I have the following directive setup in /etc/apache2/apache2.conf

<Directory /home/daniel/public/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted

From under /home/daniel/public/default running ls -Zd public test gives

drwxrwxr-x 2 daniel daniel ? 4096 Apr 28 13:44 public
drwxrwxr-x 2 daniel daniel ? 4096 Apr 28 13:44 test
  • What is your DocumentRoot? – cuonglm Apr 26 '14 at 18:53
  • What is inside test/ and public/ respectively? Have you enabled DirectoryIndex or is there an index.html on both (and if so, are the file permissions on it identical)? – Sami Laine Apr 26 '14 at 19:21
  • You didn't tell us what system you are using, so please show us output of: ls -Zd public test – Artur Szymczak Apr 26 '14 at 19:38
  • Not enough information, especially missing details of the system, your steps, documentation you followed, etc. – Pavel Šimerda Apr 26 '14 at 20:24
  • Please give us some of the key stanzas from your httpd.conf file. Also take a look at your error logs, often here: /var/log/httpd/error_log. I like to tail it like this: tail -f /var/log/httpd/error_log and then reload the URL that's causing issues. You should see a 200 if it's working, otherwise you'll see the 403 message. – slm Apr 26 '14 at 23:40

I suggest checking the Apache error log (in /var/log/apache/ on Debian/Ubuntu or /var/log/httpd/ on RedHat and derivatives). The error log will give you a more verbose indication of what's wrong; where's it's a permissions error or something else.

Another thing to try is to try and stat the file you're trying to access with sudo, with Apache's user. Something along the lines of:

sudo -u apache2 stat /var/www/public/index.html

That's assuming your web root is in /var/www and that your Apache server runs as the apache2 user. The above command will confirm whether or not the Apache process is able to read the file in question (has sufficient filesystem permissions). If it's readable (you get stat output instead of Permission denied), then the issue most likely lies with the Apache server config itself, like @mdpc suggested.

  • Running sudo -u www-data stat /home/daniel/public/default/public/index.html worked OK. – Pedder Apr 28 '14 at 13:25

Look at your apache configuration files to see if there are any allow/deny directives inside some of the directories.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.