Correct file permissions

Hi folks,

I use Piwik 3.0.4 and I am wondering what the correct file modes are for each file/directory.
At the moment all piwik files and directories are on 777 and Piwik is slow.
Could the slowlyness be due to the file modes?

Thank you very much for your experience sharing! :slight_smile:


First of all: file permissions have nothing to do with performance. But using 777 makes your setup quite insecure.

I’d recommend to use 755 for folders and 644 for files.
But before you just copy that, I’d recommend you to stop for a moment and think about what this means:

Each number sets what kind of access who has. The first digit belongs to the user who has created the file, the second digit to the group which owns the file (on unix-like operating systems every user can belong to multiple groups) and the last digit belongs to everyone else. On most shared hosters you don’t need to worry about users and groups as you can’t change them and they should be set up correctly anyway.

Now what does a permission of 7 mean?

There are three things that can be allowed or disallowed for each user: reading, writing and executing. Each of this operation now gets a number:

read      <=>  4
write      <=>  2
execute <=>  1

A permission of 6 (=4+2) now means that the user is allowed to read (4) and write (2), but not to execute the file.

As piwik doesn’t ship with binary executable files, no file needs to be executed.

To sum things up: A file permission of 644 means that the owner of the file (the webserver) is allowed to read and write the files, while every other user on the server can only read the files.

Footnote: I only mentioned file permissions. For folders the digits mean something different.

Hi Findus23,

thank you so much for your detailed answer :slight_smile:
Now I know that the performance does not have to do with the file permissions
and you gave me a great direction for setting the permissions appropriate for both files and folders.
Also you made clear that the permisisons of files and folders have different meanings and
this was before your post not so clear to me than now :slight_smile:

I changed know the permissions for piwik like you said: folders have 755 and files 644 and it is still running correctly :slight_smile:

Have a great time and thank you again for your help! :slight_smile:

1 Like