File permissions
This project provides Drush commands to automatically set up and maintain correct file permissions for your Drupal site's files directories. It ensures that the `sites/default/files` and `sites/default/private` directories are writable, creating them and their necessary `.htaccess` files if they don't exist. This helps resolve common Drupal warnings about un-writable directories.
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.
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
Activity
Release Timeline
Releases
| Version | Type | Core | Notes | Release date | |
|---|---|---|---|---|---|
| 2.1.3 | Stable | 9–11 | Fix chgrp command, verbose output and empty directory handling | Feb 28, 2026 | |
| 2.1.2 | Stable | 9–11 | Fix public and private file paths to read from settings.php correctly | Feb 28, 2026 | |
| 2.1.1 | Stable | 9–11 | Fix PHPCS coding standards violations, add phpcs.xml | Feb 27, 2026 | |
| 2.1.0 | Stable | 9–11 | Adds --user, --group and --dry-run options, fixes .htaccess permissions | Feb 27, 2026 | |
| 2.0.0 | Stable | 9–11 | This is a major release bringing full Drupal 9, 10 and 11 compatibility | Feb 27, 2026 | |
| 2.0.0-beta3 | Pre-release | 9–11 | Replace D7 private dir creation with settings.php config check | Feb 27, 2026 | |
| 2.0.0-beta2 | Pre-release | 9–11 | Add Drush 13 support and update README for Drupal 9/10/11 | Feb 26, 2026 | |
| 2.0.0-beta1 | Pre-release | 9–11 | Add Drupal 9/10/11 compatibility with Drush 10/11/12 support | Feb 26, 2026 |