Question
Setting permissions for wordpress
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×This worked for me while facing writing permissions for Themes / Plugins update via WP Dashboard.
Everyone experiencing this issue should execute these commands:
sudo usermod -aG www-data $USER
Adds the currently logged in user to the www-data group.
sudo chown -R www-data:www-data /var/www
Changes the ownership of the /var/www directory to www-data group.
sudo chmod -R 774 /var/www
Sets the proper permissions so you can upload files via sftp, manage files via command-line, and upload plugins and media directly in WordPress.
The following is not aimed toward the original poster, but toward a couple of the comment authors:
If this doesn’t fix the issue you’re having, you’ve got something else wrong and bashing DO is not going to help anyone. If you want a managed server, look for hosting elsewhere. If you need help, ask someone or hire an admin that knows how to not only ‘set things up’ but knows how to secure your server as well. You’ll be glad you did. DO is not for novices, even if they have a lot of tutorials.
Hi,
Does this still works?
I got everything under www-data but it’s a huge security risks.
However i tried to add my other username under www-data group,
Even after that when the group & owner as set as user:user, am still facing the FTP issues while upgrading or adding the plugin or themes.
Is there a working solution that allow us to use it peacefully?
I could solve my problem of directory permission using the 3 lines you have above. This saves me lots of headache. Thanks a million, Robert.
Tight work this worked for us we were unable to update our theme in WP. Thanks a ton Robert!
sudo chown -R www-data:www-data /path/to/WordPress/Installation
Sorry, for dumb question… Is it safe and right way to give all the permissions to apache for hole catalog of the site ? I’m new to it. I had the similar issue and fix it in the same way, but i’m not sure if is it right …
Right/??!! I feel the exact same way. The only thing standing in the way is file permissions…
Greetings:
For anyone on a Red Hat Linux or CentOS server, the owner:group needs to be
apache:apache
instead of
www-data:www-data
Hope this will help others using/stuck with RHEL.
It’s apparent; not all heroes wear capes.
This was my lifeline. Thanks so much.
I am having similar issues. My expectation is when I install WP through the DO admin it should just work. I can’t use migration plugins because there are file permission issues in default install of WP. I can’t upload plugins because there are file size upload limitations. I can’t run certain things because curl isn’t working out of the box.
I love the speed and performance but this has been a nightmare trying to migrate simple WP sites.
@robertcummings I just wanted to say thank you for this solution. I’ve been having this exact same problem since March and it effectively stopped me from updating anything on my site. Now everything is working perfectly!
I have the same problem, but Once I used this command sudo chmod -R 755 /var/www
, one application of the server crashes, so I’m afraid to use commands for change permisions for the other apps that i have… What solution any of you recomend me, because the wordpress it’s installed like a sudbomain in my droplet, and I have many differents apps there.
I don’t want to do a mistake , but i need to install plugins and new theme for a blog, please help me
I have the same problem. I tried everything above and nothing works. Plugin install works, WordPress automated update works but uploading a media file fails no matter what I try, I keep getting:
Unable to create directory uploads/2017/11. Is its parent directory writable by the server?
My permissions are set to drwxr-xr-x and www-data www-data I added my user to www-data. I restarted the Apache server several times. Nothing helps. I even tried a chmod 777, nothing.
My setup is Ubuntu 16.04 with Apache2, PHP7, mySQL5 and Let’s Encrypt.
Any idea what is going wrong here?
EDIT
Well, solved it! For others who might have the same issue:
I moved my WordPress install from an old server. In case of moving a setup instead of clean install you need to change the path in dashboard->Settings->Media to your absolute path. E.g.
/var/www/html/wp-content/uploads/