3

Following scenario happens to be in place. There is a server administrator (root) who doesn't know a thing about Drupal. Then, there two (or more) web developers (userA, userB), who do not have root access but are all in the group "web".

The server has several Drupal instances which have to be updated on a regular basis. Each Drupal instance is set with permissions 2775 (dirs) or 2664 (files) and belongs to either userA or userB, group in all cases is web.

When using drush to update an instance, all files that are overwritten (due to updates) now belong to the user running drush and get the permissions 644 (instead of 664). Thus, when userA updates e.g. a module, this module can't be changed or updated by userB afterwards. userA always has to chmod the files after an update.

How can this be rendered unnecessary, or how can the file permissions be kept when using Drush?

2

Write a script that correct permissions, you can find an example in this article:

Securing file permissions and ownership

Execute this script manually every time a drush update is made.

Or you can write a simple drush command that executes this script when a drush commands that cnahges files executes. Check the drush_hook_post_COMMAND: http://drupalcontrib.org/api/drupal/contributions%21drush%21docs%21drush.api.php/function/drush_hook_post_COMMAND/7

  • I do know about the manual (your first link) and I know how to fix it manually after I updated an instance. I just can't find if there is an option in Drush itself to not set the permissions during an update (or respectively set it the way we need it). – Paul Apr 9 '14 at 14:12
  • I guess the permission problems is more related to the umask of the user than to Drush (en.wikipedia.org/wiki/Umask). That's why I think the solution is to fix permissions automagically after drush executes (with the drush hooks) or semiautomatically (executing a simple bash script easy to remember). – sanzante Apr 9 '14 at 14:26
1

https://www.drupal.org/project/file_permissions

  1. Download module to your ~/.drush folder:

drush dl file_permissions-8.x --destination=~/.drush

  1. Run drush cc drush to clear Drush cache.
  2. Run drush fp to fix file permission on current site.
  • Thanks for this addition, definitely an alternative now. – Paul Mar 23 '17 at 6:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.