Configuring Joomla permissions

I see a lot of people having problems with files and folders permissions, and I pretend to describe here a step by step that I consider applicable in almost all cases.

You must have access to terminal, for this.

What user dows webservice uses?

In most of cases, the "user" that the webserver uses to read and write files, is not your terminal or ftp user, but a system user, designed only for this. You must identify this user's group.

  1. Creat a file called id.php at your site root, with the following command:
    <?php
    echo shell_exec("id");
    ?>
  2. Open the file accessing www.example.com.br/id.php
  3. You may see something like this:
    uid=85746(paulodev) gid=82559(paulodev-www) groups=205(webuser1),18279(paulodev)
  4. Note the value between parenthesis of gid=82559(paulodev-www). In this case, the user group that access the files in my hosting is paulodev-www.
  5. Write somewhere the group name and erase id.php.

 

Changing file groups and permissions:

Access your site's root folder, in terminal, and execute the following commands, changing GROUPNAME for the group name that you discovered using id.php:

chgrp -R GROUPNAME *
chmod 664 $(find . -type f)
chmod 775 $(find . -type d)

 

As each case is different, this is one of many working solutions. but as I have seen around, would work in a lot of cases.