Let the platform do the work

Setting Default File Permissions and Ownership Via config.php

Overview

Sugar allows you to specify default permissions and ownership of files created by the application when Sugar is deployed on a Linux OS.

Steps to Complete

In the config.php file located in the root directory of your Sugar installation, you will find the following array:

'default_permissions' =>
   array (
     'dir_mode' => 1528,
     'file_mode' => 432,
     'user' => '',
     'group' => '',
   ),

The 'dir_mode' and 'file_mode' values are decimal values and they equate to the octal values of 2770 and 660 respectively. These are the recommended directory and file permissions for Linux systems*. The 'user' and 'group' values determine the ownership of the files created. When empty, your Apache settings will take precedence to determine file and directory ownership. These values should be set explicitly to the Apache user and group on your server and these values will vary depending on the Apache setup and/or Linux OS you are running. To update these values, please edit the config_override.php file in the root directory of your installation and add the following lines:

 $sugar_config['default_permissions']['user'] = '<your Apache user>';
 $sugar_config['default_permissions']['group'] = '<your Apache group>';

* FreeBSD, SELinux, CPanel (or any other linux "head-end") may need to use "0770" for dir_mode