admin管理员组

文章数量:1302193

This is a weird one.

Wordpress by default stores uploaded media in monthly sub-directories of the uploads directory. Eg wp-content/uploads/2016/07/

On one of my sites, this directory's owner gets set to "root:root", which means that nothing can be uploaded to the directory via the web server.

Any ideas what might cause this behaviour? I can imagine a cron script creating this behaviour, but I don't see how Wordpress itself should be able to create a directory owned by root.

This is a weird one.

Wordpress by default stores uploaded media in monthly sub-directories of the uploads directory. Eg wp-content/uploads/2016/07/

On one of my sites, this directory's owner gets set to "root:root", which means that nothing can be uploaded to the directory via the web server.

Any ideas what might cause this behaviour? I can imagine a cron script creating this behaviour, but I don't see how Wordpress itself should be able to create a directory owned by root.

Share Improve this question asked Jul 5, 2016 at 16:50 fred2fred2 1322 silver badges11 bronze badges 4
  • Are you running your own web server? If Apache httpd, you probably didnt set the User and Group directives. – user42826 Commented Jul 5, 2016 at 16:57
  • 1 you most likely have some different process that access and change the permissions of the directories. – Mark Kaplun Commented Jul 5, 2016 at 17:21
  • This sounds like a server issue and not a wordpress issue. Have you looked on server vault? – user9447 Commented Jul 5, 2016 at 18:13
  • Try to modify your permalinks structure if wp doesn't have permissions to write to your server it would bring up an error, and even if you can modify your .htaccess file via the permalink option menu, that doesn't mean you shouldn't check further permissions. Just disincluding eventual issue. – knif3r Commented Jul 5, 2016 at 19:26
Add a comment  | 

2 Answers 2

Reset to default 9

I've had the same problem, and in my case it was the Wordpress cronjob. I was calling the wp-cron.php as a root cron job, and this script also generates the monthly upload folder.

If you call wp-cron.php via cronjob you need to do this as the web server user (or i.e. in Plesk the site user and group psacln). The owner of the created monthly folder is always the user the wp-cron.php is called from.

I had the same problem, also a cronjob, but WP CLI was the issue. The cronjob was running a 'wp plugin' command every month, the 'wp plugin' command was creating the monthly folder owned by the same user that ran the cronjob -- root.

本文标签: permissionsWordpress monthly upload directory owner set to root