1

I have Apache and wordpress installed on my ubuntu, everytime I try to upload a widget or anything, I get an error...

Tried using..

$ sudo chmod 777 /var/www*

but still nothing.. Any Advice?

Unable to create directory wp-content/uploads/2014/09. Is its parent directory writable by the server?

1

I was having the same problem,

'www-data' is the user which performs the file operations here. Assigning proper permissions for www-data can solve the problem.

Try this :

sudo chown -R www-data:www-data /path/to/your/directory/

in your case -

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

I was using nginx on ubuntu 14.04 , I hope this works for apache too. and chmod 777 is dangerous ,avoid it.

0
  • Never ever do ...

    sudo chmod 777 /var/www*
    

    It is a security risk. Basically you include "the outside world" (3rd 7) to have access to that directory. Make sure to restore the permissions to 775 for directories and 664 for files.


  • Make sure the directories you have set up from /var/www/ and deeper to be owned by the user and the group set in apache.

  • If they are different: add the user you set up in Apache to the same group as the user that needs to create the files from wordpress.

That way you will have permisions to create files without the whole world capable of putting files onn your system.


The command to add a user to an existing group is

usermod -a -G {group} {user}

Regarding wp-content/uploads/2014/09:

  • Are you sure it is this and not ./wp-content/uploads/2014/09. It could also be that there is a configuration problem related to the webroot since I would assume the notice to contain a relative path (./) or an absolute path (being /var/www/wp-content/uploads/2014/09)
  • any idea how to restore the permissions to 775 for directories and 664 for files properly ? – Itachi Sama Sep 2 '14 at 20:32
  • here is an example: linuxquestions.org/questions/linux-security-4/… BEFORE the commands do a cd /var/www and then execute the 2 commands. – Rinzwind Sep 2 '14 at 20:36
  • I'm still lost.. I never used groups before.. what group should my account be on to access apache freely ? – Itachi Sama Sep 2 '14 at 21:33
0

Can you show your error.log content? That can give the precise error.

Always keep in mind NEVER to give a chmod 777 permission to you files!

That's gonna be a fatal lesson of security for you.


Wordpress needs a proper read - write permission to work. To make sure everythings fine, try this:

Go to you public_html folder and run the commands

chown www-data:www-data  -R *
find . -type d -exec chmod 755 {} \; 
find . -type f -exec chmod 644 {} \;  

After that, you might wanna tighten your security, read this

If you want to make changes, just do what you did above, then tighten your security once more.

Hope this helps!

-Dave

  • @ItachiSama tell me if it works or not and I would be happy to help – cody cortez Dec 22 '17 at 13:46

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.