Problem with WordPress file permissions

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


Hi Vladimir, Did you find a solution to this? We’re having the same issue and even when we fix permissions, it will work okay for a few weeks but a new month of wordpress and again, the permissions won’t allow wordpress to create a new folder for media, causing an error on upload

Submit an 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.

Hey @vladimir4899b75110bc126aca! @alexdo is right on target. Make sure you also change the ownership of the files and subdirectories in your WordPress directory to the Apache group (if you are using Apache). Apache needs the right permissions in order for WordPress to work as expected.

Three helpful resources:

  • Look for the section that says “Step 5 — Configuring the WordPress Directory”. Lot’s of helpful stuff here including the command you need:
sudo chown -R www-data:www-data /var/www/wordpress

  • See the section “Use the WordPress Site Health Tool”. This built-in tool helps you see if your directories have the correct permissions.

  • This is an advanced article, but it can help you understand the complexities of ownership and permissions in Linux.

Hope this helps!



Hello, @vladimir4899b75110bc126aca

Have you tried fixing the file and folder permissions via ssh as well? You can navigate to the folder where your WordPress site is hosted (the public_html directory) and then execute the command:

find . -type d -exec chmod 755 {} \; && find . -type f -exec chmod 644 {} \;

This will change the permissions of all folders to 755 and set the file permissions to 644.

I will recommend you to upload a file and then check the file’s permissions right after it’s been uploaded as this will help you to determinate if the issue is with the permissions itself or something else is causing the issue for you.

Also via ssh you can easily check and modify the ownership of all the directories and files as well.

Let me know how it goes.

Regards, Alex

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


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


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.