Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
maniac-0s opened this issue Feb 17, 2022 · 9 comments
Closed
Labels
answered For when a question was asked and we referred to forum or answered it.

Comments

@maniac-0s
Copy link

maniac-0s commented Feb 17, 2022

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 maniac-0s added the Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. label Feb 17, 2022
@maniac-0s
Copy link
Author

Hello.

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

@LucasDemea
Copy link

Hi, same problem here

@casualuser
Copy link

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

@citananda
Copy link

Same problem here, in a docker install

@leishenglong
Copy link

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

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

@AltanS
Copy link

AltanS commented Feb 8, 2023

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

@sgiehl
Copy link
Member

sgiehl commented Feb 9, 2023

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 sgiehl closed this as completed Feb 9, 2023
@sgiehl sgiehl added answered For when a question was asked and we referred to forum or answered it. and removed Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. labels Feb 9, 2023
@JoaoSoaresDev
Copy link

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.

@kpion
Copy link

kpion commented Jul 14, 2023

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it.
Projects
None yet
Development

No branches or pull requests

9 participants