I am on matomo version:4.14.2 and while I was logging into my admin user I was getting this error:
Unable to write in the cache directory /var/www/html/tmp/templates_c/7b while trying to login into matomo from admin user
So after that I get inside the mentioned path and i checked there user it was showing root for some of the folders inside template_c. After that I applied chown -R www-data:www-data/var/www/html/tmp/templates_c/7b
It started working fine for me But I am not sure why this happened because the owner for /var/www/html/tmp/ is www-data and all the other folders in the path /var/www/html/tmp/ have user www-data.
It would be a great help If you can help me on this.
Same issue here… I have some folders with root as owner and some others with the server user. The installation was running by itself, without any changes made before the error. Now I can’t log in.
I trust you were able to use the chown command, as did Aditya. That usually fixes it.
As far as Aditya Raj question, “what causes this?”, I can confirm that this error happened to me immediately after I ran several php ./console commands as root. Three cache directories got owner changed to root. The error went away after I ran chown (see above)
Yes, no problem. Everything worked correctly after setting the server user to the folders with root user
I tend to think that some commands launched from Matomo (either manually or automatically) create this problem. For users with a minimum of knowledge it is not a problem. It would be useful to know what the cause of this is to avoid inconvenience to end users (not to mention the security uncertainty involved in renaming folders owned by the root user…).
I see no relevant information in Matomo’s log. Nor on the server. Everything seems to work normally, but if, from time to time, I take a walk through the files in the tmp/templates_c folder I see some folders with the root user.
I noticed that the date and time of last modification folders matches the Matomo archive order, triggered from a cron job. I don’t see what other information I can provide. Feel free to ask any questions you may have.
The same problem happens to me. As others have said, it is not a significant problem since it can be solved with a simple chown command, but it would be interesting to understand why it occurs periodically and how to prevent it from happening again and again.
I noticed that it usually affects only some folders (ca - 98 - and a few others if I remember correctly) which are not regenerated when you clear the entire cache. However, when they are created (later) they take root permissions.