file_permissions
Please note THIS IS NOT A UI MODULE. IT PROVIDES DRUSH COMMANDS ONLY. Please follow instructions below.
This is a set of drush commands for setting up correct file permissions in your Drupal instance. It takes care of creating sites/default/files and sites/default/private on your Drupal installation and updating them in config, so you don't have to do that through the UI. It also takes care of creating .htaccess files in those subdirectories. But most importantly it maintains correct permissions on those directories.
When would you need this?
You might be seeing one of the below notices:
The directory sites/default/files is not writable.
The directory sites/default/private is not writable.
You may need to set the correct directory at the file system settings page
or change the current directory's permissions so that it is writable.Requirements
- Drupal 9, 10 or 11
- Drush 10, 11, 12 or 13
Installation
- Download module using Composer:
composer require drupal/file_permissions - Enable the module:
drush en file_permissions
How To Use It
By simply running drush fp
Optionally, if auto-detection of the web server user and group fails, you can
provide them manually:
drush fp --user=www-data --group=www-data
To preview changes without applying them:
drush fp --dry-run
It is not recommended to use it with sudo as it
will create files owned by the root user.
Note
Because this is all about permissions, a root user is required, that's why it will ask you for sudo access.