matomo icon indicating copy to clipboard operation
matomo copied to clipboard

Matomo couldn't write to some directories (running as user 'www-data').

Open maniac-0s opened this issue 3 years ago • 5 comments

Matomo was working yesterday. Today I tried to install security info pluging and it's now reporting the following error:


Matomo couldn't write to some directories (running as user 'www-data').

Try to Execute the following commands on your server, to allow Write access on these directories:

chown -R www-data:www-data /srv/www/matomo
find /srv/www/matomo/plugins -type f -exec chmod 644 {} \;
find /srv/www/matomo/plugins -type d -exec chmod 755 {} \;

If this doesn't work, you can try to create the directories with your FTP software, and set the CHMOD to 0755 (or 0777 if 0755 is not enough). To do so with your FTP software, right click on the directories then click permissions.

After applying the modifications, you can refresh the page

If you need more help, try Matomo.org.

First, I don't want /srv/www/matomo to be owned by the webserver. This is generally bad practice, why are you suggesting this?

tmp as well as plugins however are owned by matomo. (plugin shouldn't be owned by the webserver either but it's ok temporarily when installing a plugin via GUI).

So I set everything in ./plugin 755 and owned by webserver but I still get that error...

drwxr-xr-x 68 www-data www-data 4096 Feb 14 18:02 .
drwxr-xr-x 13 luser   luser   4096 Feb 17 13:29 ..
drwxr-xr-x 12 www-data www-data 4096 Feb  3 05:13 Actions
drwxr-xr-x  7 www-data www-data 4096 Feb  3 05:13 Annotations
...

maniac-0s avatar Feb 17 '22 12:02 maniac-0s

Hello.

Even after just running the commands suggested in the error, the message still persists.

maniac-0s avatar Feb 21 '22 12:02 maniac-0s

Hi, same problem here

LucasDemea avatar Feb 22 '22 00:02 LucasDemea

same here in my docker install

this doesn't help at all

chown -R www-data:www-data /var/www/html
chmod -R 777 /var/www/html/plugins

casualuser avatar May 15 '22 12:05 casualuser

Same problem here, in a docker install

citananda avatar Jun 24 '22 10:06 citananda

vim /etc/php-fpm.d/www.conf user = root group = root

then run : php-fpm -R I do it like that ,and it works!

leishenglong avatar Sep 14 '22 07:09 leishenglong

So I encountered this today after updating my containers. I'm running matomo in a docker compose setup. I was able to fix it like this:

docker-compose exec matomo /bin/bash # start ssh shell in matomo container
chown -R www-data:www-data /var/www/html # change ownership of the folder

AltanS avatar Feb 08 '23 17:02 AltanS

Hey there. Sorry to hear you are all having problems with permissions. Unfortunately there is not much we can do about that. If the permission doesn't allow creating certain files or directories Matomo will show an error. We might suggest to grant some permissions that might look a bit too wide, but this should at least fix it for most users. Also the write access to the Matomo folder might be needed in case of running an update in the UI, as it might add files or folders in that directory. Nevertheless if the commands don't help for you please try to get some help on our forums. For permission problems with the docker container please consider raising an issue here instead: https://github.com/matomo-org/docker

sgiehl avatar Feb 09 '23 10:02 sgiehl

Same problem running in a Apache Server/Rocky 8. I've tried giving 0777 to all the folders and still didn't work. The service is running under the user "apache" and when I logged in as that user, I had permissions to read/write to the folders that were being requested.

JoaoSoaresDev avatar Mar 28 '23 02:03 JoaoSoaresDev

@sgiehl - I know it's closed and my suggestion isn't about this particular issue, but I believe you should mention on this error page ("Matomo couldn't write to some directories... ") that the /matomo/tmp dir should have its permissions set to 775. Unless I'm mistaken :) But it worked in my case.

kpion avatar Jul 14 '23 16:07 kpion