The file_check_directory does a chmod on the directory that is created.
line 105 in includes/file.inc: @chmod($directory, 0775); // Necessary for non-webserver users.
In our case this raises a problem because we installed drupal on a loadbalanced environment wich has mutliple users that can create folders.
If user a created the folder user b cannot create files in his folder because the sticky bit is lost. In our case de chmod should be @chmod($directory, 2775);.
It would be nice if there was a setting in the settings.php wich could control the chmod.
I filed this as an bug because in our case this gives us big problems and drupal 5 didn't had the problem.
Comments
Comment #1
Bèr Kessels commentedAlso note, that if the problem does not occur when we create the directories by hand. This only is a problem for directories that are created on the fly by Drupal, such as the CSS dir created when CSS-aggregation is enabled.
Comment #2
foxfabi commentedfirst i search in drupal 6.12 (core) for chmod calls with command:
I found following results:
In order to set the sticky bit on a file one must use '01777' (oct) and not '1777' (dec) as the parameter to chmod: See http://ch.php.net/chmod
With PHP 5.1.2 chmod takes off sticky bit from directory. See http://bugs.php.net/bug.php?id=37191
To fix you should try something like this: diff file.inc
hope this help.
Comment #3
miechiel commentedThanks for the reply foxabi.
I already fixed this with a chmod to 02775 wich is the proper setting for the sticky bit in our case.
But the issue is that we don't want to hack/patch our core drupal instalation. It would be nice if there would be a setting to set default folder permissions instead of @chmod($directory, 02775); // Necessary for non-webserver users.
But even more if drupal does not perform the chmod on the created folder the folder should inherit its permissions based on the main folder. In our case with the sticky bit.
Comment #4
dpearcefl commentedIs this still an active issue for you?
Comment #5
miechiel commentedYes this remains active. I made a patch for our specific setup. But i think it would be nice to fix this in core with an extra setting on the file systen in the admin interface.
I will work on a patch to fix this.
Comment #6
dpearcefl commentedThanks!
Comment #7
miechiel commentedWorks in d7 with the variable_get function so can be set in settings.php.
In our case we are adding following settings: