Review updated Securing file permissions and ownership

Created on 7 February 2020, over 4 years ago
Updated 5 September 2023, about 1 year ago

Problem/Motivation

The page Securing files, and setting permissions (Drupal 6/7) needs to be migrated to the new documentation system, so I have created a starting point for an updated version.

Everything from the original "Securing file permissions and ownership" page (edited to match Drupal 8/9/10) except "Script based on guidelines given above" has been added.

The correct commands for the new Composer based structure are missing, so any added information about the correct approach would be greatly appreciated.

Here is the updated version in the new documentation system, which needs review: Securing file permissions and ownership (Drupal 8/9/10).

Proposed resolution

Review the new documentation Securing file permissions and ownership page (Drupal 8/9/10).

Remaining tasks

Review the new documentation page and publish when revised and approved.

📌 Task
Status

Fixed

Version

11.0 🔥

Component
Documentation 

Last updated about 14 hours ago

No maintainer
Created by

🇩🇰Denmark ressa Copenhagen

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇫🇷France O'Briat Nantes

    Hi,

    I thinks this page needs an overall rewrite, it should be shorter, give less background and be more directive
    Chapters "Configuration examples", "Quick lesson in permission's numeric equivalents" & "Addendum on chmod Non-Numeric Permission Notation" should be merge and shorten, only pointing to external documentations about Linux permissions.

    The sysadmin part should mention about the "deploy user" roles, it should be allowed to modify all files in order to release the application (replace old code with the new version, update settings.php, keep contributed files, ...).

    An example of a fix permission script should be provided, it should be able to find its configuration by scanning the settings.php, looking for:
    file_chmod_directory, file_chmod_file, file_public_path, file_private_path and file_temp_path parameters

  • 🇪🇸Spain tunic Madrid

    I agree on most parts of#12 but the part about scanning parameters.

    IMHO, that will make the script complex and I think it would be more fragile, unless is Drush based, so it pulls conf from Drupal itself. But that implies a dependency with PHP, Drush and Drupal, it will fail if permissions prevent Drupal from bootstrapping.

    I use a script for this and by default detects files and private under sites folder as content folders, but you can add parameter to declare other folders. Since sites folder structure don't change often I think it is ok if users are required to do a minimal setup in the shake if simplicity.

    As a reference here's is the script: https://github.com/Metadrop/drupal-fix-permissions-script (I just published it)

  • 🇩🇰Denmark ressa Copenhagen

    Thanks for the comments. Great that you wrote a script @tunic, feel free to add a link to it in https://www.drupal.org/docs/administering-a-drupal-site/security-in-drup... .

    @O'Briat: Those are great suggestions. If you have time at some point, it would valuable for the community if you shortened the page, where you think it's relevant.

  • 🇫🇷France O'Briat Nantes

    @ressa I'll try to do it soon.

    @tunic: I didn't mean to bootstrap drupal in order to extract variables (I'm well aware about the impact of faulty Drupal installation on such scripts, specially during deployment), I rather had in mind to parse the settings.php file in an (optional) auto detect mode.

    I wonder if a third username is not missing: the one that run drush (or cron), does it need to be run via sudo -u webuser or just be the same as the deploy user ?

  • 🇪🇸Spain tunic Madrid

    #15 About the script, I think that's a great functionality, but for a demo or base script could too much effort. At least, I would add simple script on the doc page and later, if possible, add the auto discovery functionality.

    About the third user, I guess it depends on the setup, but a typical option is to run cron jobs with the web server user. In that case, probably run by root but using sudo because those users tend to be disabled and cron doesn't run for disabled users. But I wouldn't add a third user to the docs because it will be too complex. Maybe mention what i say here, that if web server user is disabled you need to use sudo.

  • 🇪🇸Spain tunic Madrid

    As suggested by #14 I've added a link to the script to fix permissions of #13 int he linked page ( https://www.drupal.org/docs/administering-a-drupal-site/security-in-drup... ).

  • Status changed to Fixed about 1 year ago
  • 🇩🇰Denmark ressa Copenhagen

    Since we agreed in the discussion page that it is Drupal 10 ready, I am changing status. Thanks everyone for working on this!

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024