Server permissions for "wp-content" in Ubuntu 12.04 LAMP.

Dear members,

I'm in trouble. Please help me.

I followed Linode Library's Getting Started Guide step-by-step and configured a LAMP stack on Ubuntu 12.04.

Then I installed Wordpress at "/home/example_user/public/example.com/public/" directory.

The problem is: I can't upload images to the site from Wordpress admin panel. And I cannot upgrade the plugins right from the Wordpress admin panel.

I googled the problem and got the impression that in Ubuntu with LAMP, you need to give "write" permissions on "wp-content" directory of Wordpress to "www-data" user (some sites said this user belongs to webserver in Ubuntu). But I don't know how to do that.

I have very few knowledge of Linux admin. Please tell me how to achieve the following tasks to solve the wordpress problem:

1- Add a new group "wpsolve".

2- Add my user and www-data to group "wpsolve".

3- Make "wp-content" directory writable to group "wpsolve".

3 Replies

1. groupadd wpsolve

2. usermod -a -G www-data wpsolve (-a = append, -G is group, so replace www-data with your other username here)

3. You can either chmod 777 or do 775 and change the wp-content group to wpsolve. Which would be like this: chown -R www-data:wpsolve /home/exampleuser/public/example.com/public/wp-content && chmod -R 775 /home/exampleuser/public/example.com/public/wp-content(where the -R flag causes recursive)

Though I'm not sure if that would be the best solution. Apache runs as user www-data, I believe PHP does as well with a LAMP stack, so you probably have uploaded the files as your normal user, so probably running this command would fix it as well:

chown -R www-data:www-data /home/example_user/public/example.com/public

:) Good luck

By the way, I believe the best way to do it is with PHP-FPM instead of the default one used by Apache. PHP-FPM you can set the user to the one you use for uploading files, and then you can simply let that user be the owner without running into permission issues.

Dear Nuvini,

Thank you soooo much for the timely and helpful answer!! You're the best!!!

You just solved the biggest hurdle I was facing in Wordpress. My installation is working fine now. :)

Each and every command you suggested worked smoothly. Right after I ran "chown -R www-data:wpsolve" for my site, the wordpress could upload the media files on its own without FTPing them manually.

I'm not familiar with PHP-FPM. (Just heard about it from you). I will try to look into it and see if I can do the needful.

Happy New Year, 2013. I wish you get lots and lots of joys and prosperity this year.

Awesome - Happy new year ;)

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct