If you are getting the following error while browsing any local website in Ubuntu like:
You don’t have permission to access http://localhost on this server files or folders
then you may not be having the full rights to access that folder or file(s). On the other end, you may be accessing the folders and files through the File Browser (while using gnome-terminal command sudo nautilus etc), but while browsing them through any web browser like Firefox etc., you may be getting the permissions error as mentioned:
403 Forbidden
You don’t have permission to access http://localhost on this server (or any of localhost’s subdirectory)
Apache/2.2.11 (Ubuntu) PHP/5.2.6-3ubuntu4.5 with Suhosin-Patch Server at localhost Port 80
etc.
For the solution, simply do the following method to grant yourself and all of the users, including admin, groups and other users, the read, write and execute rights, to stop getting such errors:
Goto Applications -> Accessories -> Terminal
and write the following code:
chmod a+rwx foldername or filename
with full path, for example:
Granting Rights on Folder:
If you are getting such error on the directory:
/var/www/webtechquery/
then the command should be:
chmod a+rwx /var/www/webtechquery/
or
chmod a+rwx /var/www/webtechquery/*
Granting Rights on File:
If you want to grant full rights on files e.g. abc.php, then the command should be:
chmod a+rwx /var/www/webtechquery/abc.php
If you want the rights to be granted to only the owner, group or specific user(s), then use the following commands:
For Owner:
chmod o+rwx /var/www/webtechquery/abc.php
For Group:
chmod g+rwx /var/www/webtechquery/abc.php
For User:
chmod u+rwx /var/www/webtechquery/abc.php
where:
o = owner
u = user
g = group
and
r = read
w = write
x = execute




June 18th, 2012 at 4:55 am
thank u very much it really helpful for me
April 12th, 2012 at 2:17 am
Hi Juan,
Can you tell me about your problem in detail, so I may further try to help you out.
Thanks
April 7th, 2012 at 12:52 pm
In my case even do that the proble persist, whath another thing it could be.
October 12th, 2011 at 2:38 pm
Neither changing the /etc/apache2/sites-available/default file to my real folder WWW in my home directory !!
But my real WWW has 777 permisions, with chmod -R 777 www
Any idea !
October 12th, 2011 at 2:24 pm
UPDATE !
If i paste my entire WWW into /var it’s works, only with the softlink doesnt work !
Any idea ! maybe is a basic thing but i cant find a good solution.
October 12th, 2011 at 2:20 pm
Any idea?
I have the /var/ww directory with 777 and it works !
But when i paste in /var the softlink to my www in my home doesnt work ! and the link www has the 777 and all the directory in my home has 777
thanks in advance !
October 7th, 2011 at 8:18 pm
Thanks, but this didn’t work for me. It changed the permissions, but it didn’t fix the 403 error I’m getting. (and yes, I chown’d it so www-data group has access). I’m very perplexed.
August 5th, 2011 at 9:26 am
Hey,i changed the permissions but i still get the error.I copied a folder to the www directory,and the tried to acess its content via localhost and got the error.Someone help.
March 4th, 2011 at 7:58 am
Hey there, this was pf very much help my friend,
but for some reason i am only able to grant permissions to the files within the main files and not the files within the subfiles, so it ends up working sorta half way.
Or not working at all as you can imagine if i’m using a CMS of some sort…
Any suggestions on how to fix that?
thanx ahead of time!
March 2nd, 2010 at 4:30 am
Hai,
I am new to Ubuntu Server 9.10. I am running a web server in Ubuntu. I want to make my webserver more secure. Can you suggest me the way to webserver more secure ?
Regards
Jithin k