Here is what i use as a solution to this,
if anyone else can use it, hope it works for you also.
Step 1
create a file called permissions.php on the root of your suite crm instance
add this to the file
Running over file and directory permissions...
<?php
function get_execution_time()
{
static $microtime_start = null;
if($microtime_start === null)
{
$microtime_start = microtime(true);
return 0.0;
}
return microtime(true) - $microtime_start;
}
get_execution_time();
function chmod_R($path, $filemode = 0644, $dirmode = 0755) {
if (is_dir($path) ) {
if (!chmod($path, $dirmode)) {
$dirmode_str=decoct($dirmode);
print “Failed applying filemode ‘$dirmode_str’ on directory ‘$path’\n”;
print " `-> the directory ‘$path’ will be skipped from recursive chmod\n";
return;
}
$dh = opendir($path);
while (($file = readdir($dh)) !== false) {
if($file != ‘.’ && $file != ‘…’) {
$fullpath = $path.’/’.$file;
chmod_R($fullpath, $filemode,$dirmode);
}
}
closedir($dh);
} else {
if (is_link($path)) {
print “link ‘$path’ is skipped\n”;
return;
}
if (!chmod($path, $filemode)) {
$filemode_str=decoct($filemode);
print “Failed: ‘$filemode_str’ on file ‘$path’\n”;
return;
}
}
}
$current_user = get_current_user();
echo ’ Script owner: ’ . $current_user . ‘
’;
$processUser = posix_getpwuid(posix_geteuid());
$processUserName = $processUser;
echo ‘Process owner: ‘. $processUserName .’
’;
// Phase I: 644 all files, 755 all folders.
echo “
1: Permissions. 644 all files, 755 all folders
Fixing: set all files to 644, all folders to 755, recursively.
”;
chmod_R ( “./” );
// Phase II: 664 files, 775 folders.
echo “
2: Permissions. Some files 664 and some folders 775.
”;
chmod_R ( “./config.php”, 0664, 0775 );
echo “
Fixing config_override.php
”;
chmod_R ( “./config_override.php”, 0664, 0775 );
echo “
Fixing sugarcrm.log
”;
chmod_R ( “./sugarcrm.log”, 0664, 0775 );
echo “
Fixing cache dir (all files and subdirs)
”;
chmod_R ( “./cache”, 0664, 0775 );
echo “
Fixing custom dir (all files and subdirs)
”;
chmod_R ( “./custom”, 0664, 0775 );
echo “
Fixing data dir (all files and subdirs)
”;
chmod_R ( “./data”, 0664, 0775 );
echo “
Fixing modules dir (all files and subdirs)
”;
chmod_R ( “./modules”, 0664, 0775 );
//Phase III: Fix settings inside ./config.php and ./include/utils.php
echo "
3: Do the following manually.
Fix the default_permissions setting in 3 places:
1) ./config.php
";
$fixed_config = “‘dir_mode’ => 02755,\n ‘file_mode’ => 0644,\n ‘user’ => ‘$current_user’,\n ‘group’ => ‘$current_user’,”;
echo " ‘default_permissions’ => array (
$fixed_config
),
\n";
echo "
2) ./include/utils.php - in the function make_sugar_config() - line 138
";
$fixed_make_sugar_config = “‘dir_mode’ => 02770,\n ‘file_mode’ => 0660,\n ‘chown’ => ‘$current_user’,\n ‘chgroup’ => ‘$current_user’,”;
echo " ‘default_permissions’ => array (
$fixed_make_sugar_config
),
\n";
echo “
3) ./include/utils.php - in the function get_sugar_config_defaults() - line 264
”;
$fixed_get_sugar_config_defaults = “‘dir_mode’ => 02770,\n ‘file_mode’ => 0660,\n ‘user’ => ‘$current_user’,\n ‘group’ => ‘$current_user’,”;
echo " ‘default_permissions’ => array (
$fixed_get_sugar_config_defaults
),
\n";
echo “
Happy Days.
”;
echo “
Execution time: “.get_execution_time().” seconds.
”
?>
Step 2
save the file
Then run the file from your browser
www.whateveryourcrm.com/permissions.php