Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have set up a LAMP server and I have access via SSH and to the "it works" page from a web browser from inside my network (via ip address) and from outside using dyndns.

We have some Wordpress projects that sit in subdirectories in /var/www/wordpress1 /var/www/wordpress2, etc. I cannot access these sub directories from a browser in order to set up WP--or (I assume) to see the content on a browser. I get a 403 Forbidden error on my browser.

I assume that this is a permissions problem. Can you please tell me the proper settings for the permissions to:

  1. Allow the developers and me to read/write.
  2. to allow WP set up and do its thing
  3. Allow visitors to access the site(s) via the web.

I should also mention that the subfolder are actually simlinks to folder on another internal hdd--I don't think this will make a difference, but I thought I should disclose.

total 12
drwxr-xr-x  2 root root 4096 2012-07-12 10:55 .
drwxr-xr-x 13 root root 4096 2012-07-11 20:02 ..
lrwxrwxrwx  1 root root   43 2012-07-11 20:45 admin_media ->     /root/django_src/django/contrib/admin/media
-rw-r--r--  1 root root  177 2012-07-11 17:50 index.html
lrwxrwxrwx  1 root root   14 2012-07-11 20:42 media -> /hdd/web/media
lrwxrwxrwx  1 root root   18 2012-07-12 10:55 wordpress -> /hdd/web/wordpress

Here is the result of using chown -R www-data:www-data /var/www

total 12
drwxr-xr-x  2 www-data www-data 4096 2012-07-12 10:55 .
drwxr-xr-x 13 root     root     4096 2012-07-11 20:02 ..
lrwxrwxrwx  1 www-data www-data   43 2012-07-11 20:45 admin_media -> /root/django_src/django/contrib/admin/media
-rw-r--r--  1 www-data www-data  177 2012-07-11 17:50 index.html
lrwxrwxrwx  1 www-data www-data   14 2012-07-11 20:42 media -> /hdd/web/media
lrwxrwxrwx  1 www-data www-data   18 2012-07-12 10:55 wordpress -> /hdd/web/wordpress

I am still unable to access via browser.

share|improve this question
Please post the output of the command ls -la /var/www. –  SirCharlo Jul 12 '12 at 16:52
please put that information in your question! –  Jorge Castro Jul 12 '12 at 16:57
OK, it took a second for me to remember how to post code... –  dpbklyn Jul 12 '12 at 17:05
Ok, well try chown -R www-data:www-data /var/www –  SirCharlo Jul 12 '12 at 17:08
I think your problem now is that you are using links. Apache will not follow links. What you would do is move those files to /var/www and configure apache to use vitrualhosts. See help.ubuntu.com/10.04/serverguide/httpd.html Alternates, if you wish to use /hdd/web/wordpress would be to configure Apache (root directory) properly. You can configure apache to use links, but I do not advise it. See also help.ubuntu.com/community/WordPress –  bodhi.zazen Jul 12 '12 at 18:37

4 Answers 4

First, you should ensure that your username is included in www-data group. If not, you can add your username as www-data group

sudo adduser yourusername www-data

yourusername can be changed with your username.

After that, you should change the ownership of /var/www to your username

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

Next step, you should change permission to 755, not recommend changing permission to 777 for security reason

sudo chmod 0755 -R /var/www
sudo chmod g+s -R /var/www

Hope it helps...

share|improve this answer
didn't work for me, I add to use sudo chown www-data:www-data -R mywordpressdirectory/ –  Louis Nov 20 '14 at 17:23
After change the ownership, you should change permission too. Have you change your permission to 755? –  metamorph Nov 23 '14 at 1:27

Check that Apache has execute rights for /hdd/web/media and /hdd/web/wordpress.


chmod o+x /root /root/site /root/site/about

Moreover, Apache has to be configured to allow access to the directory on the filesystem. This has to be done by a system administrator by inserting a directive in the apache configuration files (httpd.conf).

Since the real directory is inside the web root it must be accessible, but FollowSymLinks may not have been enabled for the directory - this also has to be added to the directive.

See http://httpd.apache.org/docs/2.0/mod/core.html#directory

share|improve this answer
Thanks all...I have decided to go with the path of least resistance...removed the symlinks. All works perfectly. –  dpbklyn Jul 13 '12 at 14:20

Reading around the instalation guide for Ubuntu..

chown -R www-data /usr/share/wordpress

Maybe it could be easier to instal it this way instead of trying to unzip the files on /var/www


any way wordpress runs on apache... right? if you want to do it that way.. you show do as @metamorph an then give permisson on apache2 httpd.conf like this:

<VirtualHost *:80>
        ServerName site
        ServerName site.domain
        DocumentRoot /srv/www/wordpress.site

        DirectoryIndex index.php


and then default-server.conf.

<Directory "/srv/www/wordpress.site">
        Options None
        AllowOverride None
        Order allow,deny
        Allow from all

Maybe is best to do the step by step https://help.ubuntu.com/community/WordPress

share|improve this answer

metamorph's was along the right lines, however I was still having issues.

In the end this post on the ubuntu forum worked for me.

share|improve this answer
Could you summarize the steps you took to fix it here? Thanks! –  Seth Jun 24 '14 at 22:07
I don't know why your answer is down voted. anyway it helped me and would like to thank.. with a up vote. :) –  anujsharma9196 Feb 28 at 5:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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