1

For learning and practical purpose, I create a repo for a complete Joomla folder on a remote linux server, then I push it to github. Then I tried two ways to get the files to my local Mac.

Firstly, I download .zip file of the repo from github and unzip them to local dir, then I edit configuration.php to connect to the remote database. The site has no problem opening.

Secondly, I use "github desktop" to clone the repo to local dir, then edit configuration.php. But when I open the website, I get this "Failed to load 'rt_photon' template: mkdir(): Permission denied" error. I know this is related with file owner/permission, but I can't identify what exactly it is. I just do chown -R root:root and chmod -R 0777 and the website can be open now.

I use Rockettheme's "rt_photon" template, but I think that is probably irrelevant. Can anyone explain to me how file owner/permission affect joomla site and why the cloned repo and the unzipped folder have different file owner/permission setting(suppose this is the reason of the error)?

  • Did you check the temp dir configuration? – Max Mar 31 '16 at 2:23
  • Maybe this link could help you. Try to clone your repo again, and see which permissions and owner it gets. – Rene Korss Mar 31 '16 at 5:54
2

To set files and directories to chmod 777 or even chmod 770 is not a good idea on a production system.

Every webserver system like apache2, nginx can be configured to work with a special user and group - that's important not to get any user rights on the system. On most Debian like systems, the user is set to www-data with group www-data, standard is the user ID = 33. On an arch linux system, the standard user:group is set to http:http, but nevertheless, you can change these settings manually.

For more than one user to be able to write to the same directory it will be necessary to grant write permission to a group they share in common. So you have to get the same group permission for the www-data and your user account.

When you log-in, you will get no permission to write to the base folder of the Joomla files. That's good news, nobody should be able to compromit your Joomla system. So it is good to unset world writeable.

Example setup with /var/www as base directory on a production system: To get a group related permission:

First of this procedure, you have to add the one user e.g. userxyz who should have access to the group www-data :

  • sudo usermod -a -G www-data userxyz

  • Set umask 002 general for all users in /etc/profile or in specific home directory at ~/.bashrc when using bash or similar shell config. You can test the settings after a new log-in with umask

  • sudo chown -R www-data:www-data /var/www set user and group to www-data

  • sudo find /var/www -type d -print0 | xargs -0 chmod 2775 sets all directories, that everyone has read and execute permission, while the file owner and members of the file's group additionally have write permission. And any files or subdirectories created in that directory will inherit the parent directory's group id (setgid mode).

  • sudo find /var/www -type f -print0 | xargs -0 chmod 664 sets all files with read permissoin and only group (www-data) and owner to write/delete permission.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.