joomla/joomla-cms — pull request #2350 by dex4er (2013-10-26 23:09:14+00:00)
Title: Allow to set the default file mode and dir mode

Joomla creates new files and directories with umask 022. It might be problematic when ie. files has following privileges after installing new plugin:

$ ls -ld plugins/system/
drwxr-xr-x 2 dexter dexter 4096 paź 27 00:53 plugins/system/admin8/
$ ls -ld plugins/system/admin8/
drwxr-xr-x 2 www-data www-data 4096 paź 27 00:53 plugins/system/admin8/
$ ls -ld plugins/system/admin8/admin8.xml
-rw-r--r-- 1 www-data www-data 830 paź 27 01:04 plugins/system/admin8/admin8.xml

It means that it is impossible to edit or even remove files from this directory.

The possible solution is to set umask 002 for Apache and Joomla, and put the user and the server in the same group (and chmod g+s for directories). After this:

$ ls -ld plugins/system/
drwxrwsr-x 2 dexter joomla 4096 paź 27 00:53 plugins/system/admin8/
$ ls -ld plugins/system/admin8/
drwxrwsr-x 2 www-data joomla 4096 paź 27 00:53 plugins/system/admin8/
$ ls -ld plugins/system/admin8/admin8.xml
-rw-rw-r-- 1 www-data joomla 830 paź 27 01:04 plugins/system/admin8/admin8.xml

Now I have rw priviliges to joomla files even if they're created by web server.

The patch allow to change the default file and directory modes.