1

I was running localhost (Apache 2.4.6) but only the index.php was openable in the web browser. The subdirectories were returning 403 Forbidden error.

Now, I added the permissions according to this answer. For reference, these were the permissions:

sudo adduser <username> www-data
sudo chown -R www-data:www-data /var/www
sudo chmod -R g+rw /var/www

Accordingly, the folder in which I placed all the content of the website became owned by www-data group. And although I've added myself to the group, I cannot open the folder!

(But the subdirectories have become accessible from the web browser.)

4

First are you sure your user is added to www-data group? The proper way to add your user to this group is:

sudo adduser yourusername www-data

Then do:

sudo chown yourusername:www-data -R /var/www

After that, you should change permissions to 755, it is not recommend changing permissions to 777 for security reasons

sudo chmod 0755 -R /var/www  
sudo chmod g+s -R /var/www
| improve this answer | |
  • Oh it worked! I just didn't do the last step (change permissions to 755). By the way, my directory was not /var/www. Thanks! – Abhimanyu Apr 7 '15 at 4:06

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.