Report this

What is the reason for this report?

Problem with WordPress file permissions

Posted on February 6, 2020

Hello gentlemen, ever since we moved our site to digital ocean we have issues with our site media library. We are using a premade image, running ubuntu on cyberportal with openlitespeed on it.

Our root www folder is /home/sitename/public_html/ and everything inside that is set to be under www-data ownership (we tried different options as well). While the whole dir is owned by www-data our media library can’t be updated and wordpress triggers the error (can’t move file to the folder, etc).

Even worse, site library can access all of the existing media (the ones that we moved manually) and display them properly, but all of the newly updated/crated posts and media won’t show properly. It looks like while posting something the media/file is saved but then it gets removed from a featured image (for example) and its thumbnail is broken. We can access the image through a direct link.

I tried everything I could find, from scripts to fix the permissions, through cyberpanel fix permissions and ssh but everything failed. Does anyone have any clue what this could be? Again, only images uploaded now are broken, not the ones that are there already.

Please advice



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

Hello,

Sometimes incorrect file permissions may prevent you from doing the following:

  • Install or update themes and plugins
  • Move articles or pages to the trash
  • Upload files to your media library

The best way to organize permissions is to use FTP. After connecting to the server, select wp-admin,wp-includes,and wp-content. Right-click on them and select File Permissions:

In the window that appears, set Value to 755. Select recursively into subdirectories and apply only to directories. Repeat the process, but set the Value to 644, then choose to recurse into subdirectories and apply only to files:

Then, select the remaining files in public_html.Right-click on them and select File Permissions again. The value should be 644 again, but don’t worry about other settings.That is to say, the general permission of the file directory is 755, and the file permission is generally 644.

I am sorry that I have just used WordPress for a short while.If my suggestion doesn’t work,please wait for others’ awesome resolution.Go to forums connect to WordPress may helps you.

Best wishes.

Shiroka

Hi

CyberPanel did not used www-data by default. You can check the right owner from ls /home/DOMAIN from console. Or just upload files from file manager inside of the CyberPanel.

Best, Eric

Unfortunately, that didn’t do the trick either. I tried fixing that (with the actual username - chown), but didn’t work.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.