I just need to know if these permission are corrects:

site --> 775
site/default -->775
site/default/files --> 775
site/default/setting.php --> 555
  • 5
    This question cannot be answered without knowing what the default user:group is on the files and what user and groups your webserver runs as. It should be closed as "unclear what you're asking". Alternatively as a duplicate of: drupal.stackexchange.com/questions/373/… Commented Jun 8, 2014 at 3:17

5 Answers 5


Actually the permissions should be

sites -> 755
sites/default -> 755
sites/default/files -> 775
sites/default/settings.php -> 444

See the top 3 answers to this question for some great details.

  • 3
    While upvoted and accepted, this is not a good answer. The question is incomplete and there is no way of knowing whether this answer is right for the OPs configuraton (or for anyone else). Only thing good about it is the link. Commented Jun 7, 2014 at 17:33
  • Not to mention the directory is sites, not site. : D Commented Feb 6, 2016 at 21:45

From Drupal's official handbook:

Copy this into a file and name it as "fix-permissions.sh"

if [ $(id -u) != 0 ]; then
        printf "This script must be run as root.\n"
        exit 1
# Help menu
print_help() {
cat <<-HELP
This script is used to fix permissions of a Drupal installation
you need to provide the following arguments:
1) Path to your Drupal installation.
2) Username of the user that you want to give files/directories ownership.
3) HTTPD group name (defaults to www-data for Apache).
Usage: (sudo) bash ${0##*/} --drupal_path=PATH --drupal_user=USER --httpd_group=GROUP
Example: (sudo) bash ${0##*/} --drupal_path=/usr/local/apache2/htdocs --drupal_user=john --httpd_group=www-data
exit 0
# Parse Command Line Arguments
while [ $# -gt 0 ]; do
        case "$1" in
--help) print_help;;
printf "Invalid argument, run --help for valid arguments.\n";
exit 1
if [ -z "${drupal_path}" ] || [ ! -d "${drupal_path}/sites" ] || [ ! -f "${drupal_path}/core/modules/system/system.module" ] && [ ! -f "${drupal_path}/modules/system/system.module" ]; then
printf "Please provide a valid Drupal path.\n"
exit 1
if [ -z "${drupal_user}" ] || [ $(id -un ${drupal_user} 2> /dev/null) != "${drupal_user}" ]; then
printf "Please provide a valid user.\n"
exit 1
cd $drupal_path
printf "Changing ownership of all contents of "${drupal_path}":\n user => "${drupal_user}" \t group => "${httpd_group}"\n"
chown -R ${drupal_user}:${httpd_group} .
printf "Changing permissions of all directories inside "${drupal_path}" to "rwxr-x---"...\n"
find . -type d -exec chmod u=rwx,g=rx,o= '{}' \;
printf "Changing permissions of all files inside "${drupal_path}" to "rw-r-----"...\n"
find . -type f -exec chmod u=rw,g=r,o= '{}' \;
printf "Changing permissions of "files" directories in "${drupal_path}/sites" to "rwxrwx---"...\n"
cd sites
find . -type d -name files -exec chmod ug=rwx,o= '{}' \;
printf "Changing permissions of all files inside all "files" directories in "${drupal_path}/sites" to "rw-rw----"...\n"
printf "Changing permissions of all directories inside all "files" directories in "${drupal_path}/sites" to "rwxrwx---"...\n"
for x in ./*/files; do
find ${x} -type d -exec chmod ug=rwx,o= '{}' \;
find ${x} -type f -exec chmod ug=rw,o= '{}' \;
echo "Done settings proper permissions on files and directories"

Now run this script as: sudo bash fix-permissions.sh --drupal_path=your/drupal/path --drupal_user=your_user_name

Viola! Your permissions are automatically fixed.

  • Make sure you read that whole post, and the comments.
    – mpdonadio
    Commented Jun 7, 2014 at 20:53
  • And paste this file where? In what directory? Commented Jan 22, 2018 at 11:08

This is how I decided to set permissions for my Drupal instance:

mkdir sites/default/files
chgrp -Rv apache sites/default/files
chmod 2775 sites/default/files

We do this by using 2775 in our chmod command. The 2 means that the group id will be preserved for any new files created in this directory. What that means is that apache will always be the group on any files, thereby ensuring that web server and the user will both always have write permissions to any new files that are placed in this directory. The first 7 means that the owner (example) can R (Read) W (Write) and X (Execute) any files in here. The second 7 means that group (www-data) can also R W and X any files in this directory. Finally, the 5 means that other users can R and X files, but not write.

Another point is to set correct permissions for your settings.php

chmod 444 sites/default/settings.php

Other permissions are to be default.

Complete Drupal Installation guide: http://itvictories.com/node/21


Selected answer is not quite correct, especially when there are few unknowns there, however Aleks explained it quite extensively, and it's very similar approach that I take on Drupal sites.

Also, I thought I would share my script here as well, but as a Drupal Module, that I've created some time ago. You can place it in ~/.drush subdirectory and simply execute drush file-permissions while being in any working Drupal site subdirectory.

It bootstraps your Drupal site, checks for file_private_path, file_public_path and sets them to correct Apache user and group. Apache user / group is being determined automatically, so it's not relying on the user specifying them manually or having them hard-coded in a script file.

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

  • Would be great to port the module to Drupal 8
    – Benedikt
    Commented Jul 12, 2016 at 8:16
  • module doesn't change permission for tmp folder. Is that intentional? In my configurtion tmp is set to site/default/tmp and no permission change is applied to that directory.
    – kiranking
    Commented Sep 26, 2018 at 8:14

As the other guys mentioned the correct permission is

All Drectories -> 755
All files -> 755
sites/default -> 755(this override up rule this directory)
sites/default/files -> 775 (this override up rule for this directory and it's contents)
sites/default/settings.php -> 444(this override up rule for this file)

The appropriate commands to achieve mentioned Rules comes in the following,at the root of your Drupal website

find . -type f | xargs chmod 644
find . -type d | xargs chmod 755
chmod 444 sites/default/settings.php
chmod 775 -R sites/default/files

to make it writeable by webserver you can use the following command

chcon -R -t httpd_sys_rw_content_t sites/default/files

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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