Why are the permissions set to 02770 and 0660 in utils.php?

Before you begin your install of SuiteCRM, you’re required to make sure that certain directories have specific permissions (775 & 664), so that the CRM can write to these directories and files. If not, you get a lot of weird buggy behavior. Lots of labels come up as “Undefined.”

When you install SuiteCRM, it creates the “config” file that sets up the permissions whenever files or directories are created. Cool, but if you look at the “config” file after installation, it has the following values for directories and files, respectively: 1528 and 432. These two number convert to 02770 and 0660, which are not the permission settings it requires.

After some searching, I’ve noticed that it’s rooted in “/include/utils.php” where the file permissions are set as defined above in octal, 02770 and 0660 at lines 140,141 and 281,282.

These lines of code are obviously causing issues with permissions. Is this a bug that no one’s been able to figure out or is there a reason they are set at 02770 and 0660?

Why is there no function to write desired permissions to desired directories and files if you can do it for directories and files on install?

If you search the forum I and others have suggested several times to adjust those values in utils.php before installing.

Furthermore I have highlighted in the past what I believe to be another bug in utils.php: the array keys are defined as chown (instead of user) and chgrp (instead of group).
If you search through the files you will not find reference to those keys while you will find reference to user and group.

In my opinion this could be a bug. I asked in the past the SugarCRM team but got no answer so I also filed a bug in the SugarCRM github dev space more than a year ago (https://github.com/sugarcrm/sugarcrm_dev/pull/207), but it still has not been corrected.

I agree with you: by fixing these two things there probably would be less buggy undefined lables!

I’ve written on the SugarCRM forum as well on this matter.

It’s not difficult to correct. I suspect that the leaders of the development team have a reason for ignoring these tiny, yet powerful, bugs.

My only concern is when updates are installed, if my changes would get overwritten.

I suppose I could write something in config_overrides.php, but once you let the CRM install all the new files and directories, you’re kind screwed, unless you enjoy going through everything and resetting all permissions.

I know there’s some commands that can change permissions recursively, but I’d rather it be right from the start.

I think it is safer to execute the commands that change the permissions recursively.

I haven’t found anything in the codebase that does it therefore you have to do it before the install (better if you also do it after. And I also do it between ech step of the installation).

I have written a php script, which I shared in the forum, that resets permissions recursively. Additionally I have set up a crontab in myserver that runs my script every 30 minutes.
By doing this I have reduced (but not 100%) the permissions related bugs.

Modifying utils.php is not upgrade safe therefore you have to repeat the modification each time you install an upgrade.

Hi, where would I find your php script. I can’t find it in your other forums posts.