Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File permissions issues with AbstractDrupalCommands::permissionsSetup() #113

Open
vever001 opened this issue Mar 3, 2020 · 3 comments
Open

Comments

@vever001
Copy link

vever001 commented Mar 3, 2020

Hi,

Is there a valid reason why AbstractDrupalCommands::permissionsSetup() makes a chmod 775 -R on the whole sites subdir here?

We currently have code under the sites subdir (D8 multisite - e.g: sites/*/modules, sites/*/themes) where all files are 664.
Every time permissionsSetup() gets called, these files get their permissions changed.

If I'm not mistaken, it should only make a chmod 775 on the sites-subdir (non-recursively) and alter the permissions for settings.php.
Could you confirm? If so I can work on a PR.

Thank you,
Hervé

@donquixote
Copy link

Hello,
the correct thing to do here would be to enable the "x" bit on directories, but disable it on files.
On directories, "x" means you can get a list of the directory contents. For most directories this is desirable.
On files, "x" means you can execute the file. For most files this is not desirable.

With pure cli commands this can be achieved by:

chmod -R a-x,a+X dir

The lowercase x applies to all files and directories, the uppercase X only applies to directories.
(See https://superuser.com/a/91966, but you have to go into the comments to find the ideal solution.)

Unfortunately I don't see how we would do this with symfony filesystem recursive chmod, which expects an integer umask and does not work with strings like a-x.

@donquixote
Copy link

I also notice that the recursive chmod of symfony filesystem also modifies symlinked files.

I have a project with a symlink from build/sites/default/setings.symlink.php to ../../../resources/settings.symlink.php. Every time I run composer install, the drupal:settings-setup changes the perms for the target file (not the symlink itself) to 775.

@donquixote
Copy link

Also why do we make settings.php and other files writable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants