0

I was just following this tutorial, I did exactly like he did from 02:30 to 03:30: added a folder in /wp-content/themes/mytheme, inside mytheme added a style.css and index.php. When I went to dashboard it wasn't added automatically so I tried to upload the theme.zip manually. Now I'm getting the error message "Could not create directory". I already set chmod -R 777 to wordpress folder but still having this.

The same error is going on on any operation I do that involves writing data to /var/www/html/wordpress like updating. I already tried what has been suggested here, tried also to gpasswd -a www-data sudo and nothing... I have no idea now what to do.

Output of ls -la:

lrwxrwxrwx 1 fabio www-data    20 Jan  4 16:45 wordpress -> /usr/share/wordpress

Output of ls -ld /usr/share/wordpress:

drwxrwxrwx 5 www-data root 4096 Jan 8 15:46 /usr/share/wordpress 

Output of ls -l /usr/share/wordpress:

total 184
-rw-r--r--  1 root     root   418 Set 24  2013 index.php
-rw-r--r--  1 root     root 19930 Jan  2 01:48 license.txt
-rw-r--r--  1 root     root  7360 Dez 10 08:56 readme.html
-rw-r--r--  1 root     root  5035 Out  6 18:56 wp-activate.php
drwxrwxrwx  9 www-data root  4096 Jan  8 15:28 wp-admin
-rw-r--r--  1 root     root   271 Jan  8  2012 wp-blog-header.php
-rw-r--r--  1 root     root  1369 Out  3 11:47 wp-comments-post.php
-rwxrwxrwx  1 www-data root  2381 Abr  9  2014 wp-config.php
-rw-r--r--  1 root     root  2853 Dez 16 07:58 wp-config-sample.php
drwxrwxrwx  5 www-data root  4096 Jan  4 16:41 wp-content
-rw-r--r--  1 root     root  3286 Mai 24  2015 wp-cron.php
drwxrwxrwx 16 www-data root 12288 Jan  8 15:29 wp-includes
-rw-r--r--  1 root     root  2380 Out 24  2013 wp-links-opml.php
-rw-r--r--  1 root     root  3316 Nov  5 21:59 wp-load.php
-rw-r--r--  1 root     root 33770 Dez 21 01:30 wp-login.php
-rw-r--r--  1 root     root  7887 Out  6 11:07 wp-mail.php
-rw-r--r--  1 root     root 13021 Nov 20 05:24 wp-settings.php
-rw-r--r--  1 root     root 28594 Out 30 06:52 wp-signup.php
-rw-r--r--  1 root     root  4035 Nov 30  2014 wp-trackback.php
-rw-r--r--  1 root     root  3061 Out  2 19:46 xmlrpc.php
fabionr
  • 13
  • chmod does not follow symlinks by default. What's the output from ls -ld /usr/share/wordpress and ls -l /usr/share/wordpress? Also, what's the exact error message you are getting? Permission denied? – Andrea Corbellini Jan 08 '16 at 18:12
  • The error message is "Could not create directory". I got it when trying to update, add new theme, etc ls -ld /usr/share/wordpress: drwxrwxrwx 5 www-data root 4096 Jan 8 15:46 /usr/share/wordpress output of ls -l http://pastebin.com/qzE18Hwz – fabionr Jan 08 '16 at 18:29
  • Original Question:
    Correct permissions for /var/www and wordpress is Answered here
    – Krunal Sonparate Jul 24 '18 at 10:29

1 Answers1

0

First, In Terminal user change into root user.

Ubuntu - sudo su. other - su

Second , 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 $USER www-data

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

sudo chown $USER: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...

RV Sakthivel
  • 107
  • 11
  • Beware that with chmod 0755 -R you are changing permissions for both files and directories! Also, what's the point of adding the user to www-data if afterward you do chown $USER:www-data -R? – Andrea Corbellini Jan 08 '16 at 18:25
  • already done this, didn't worked – fabionr Jan 08 '16 at 18:25
  • i think you are didn't change to root. owner permission into www-data, i already did. i running my server more then 22 WordPress – RV Sakthivel Jan 08 '16 at 18:28
  • Sorry, I didn't understand what you said. I already give permission of /var/www/html/wordpress to www-data and /usr/share/wordpress – fabionr Jan 08 '16 at 18:35