Constantly Having to Reclaim Wp-Uploads Folder Permissions

I have started noticing this with a few of my OpenLiteSpeed wordpress sites now, running WP 6+.

Each month when the new monthly wp-uploads directory is created (eg October/November /uploads/2021/10/ /2021/11 etc) , the permissions are WRONG.

I get the error “the uploaded file could not be moved to…” and it appears that the folder has been created with root as the owner, and not www-data.

Numerous times I have run the command:

sudo chown -R www-data /var/www/mysite/wp-content/uploads

I recursively run this command on both the uploads directory and wp-content parent directory, but it seems i’m having to run it every month on the new folder created in uploads.

Obviously something is wrong here, can anyone possibly advise what the problem is here?

Not entirely sure how to add an image here but all of my folders are www-data:www-data, it seems the new ones are being created with the wrong permissions.

Any advice much appreciated. Thanks. Its getting annoying and i’m losing business because my website relies on users adding content and listings, and if they cant upload images i’ll be losing money.

Submit an answer
Answer a question...

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!

Sign In or Sign Up to Answer

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.

Site Moderator
Site Moderator badge
November 7, 2022

Hello there,

This should be related to having WordPress cron jobs running as the root username.

We also have an article which covers this issue and possible ways to sort out the problem which you can check here


Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @mburdett555,

I understand you. Specifically what is the user that assigns you in the folders? Are you using PHP-FPM ?

I recommend you check out Hardening Wordpress, provides a lot of information on the subject.

Let me know more information.

Sergio Turpín