2

I am hoping a I can get a little help on a problem that I continually struggle with and that seems to impact a number of places on a site that I have copied over from a production version.

So I have a site for which I created a development environment for on an Amazon EC2 instance (original site is not on Amazon EC2). So far everything is loading up and showing for the most part. But it is becoming clear that in handling administrative tasks I am running into file permission problems.

For instance, If I go to *Administrator > Site Building > Themes > My Custom Theme* to configure the favicon, I get the error:

The directory sites/default/files is not writable

I have tried chmod 775 and that does not work. If I do chmod 777 the css files don't load and the site is without styles. I have tried chown 6226 (which seems to be the default user from when I did a fresh install of drupal 6.20 on the new server). And have tried chown ec2-user (the default ec2 instance user) as well as chown the user from the production server (for which there is a user with the same name on the new server).

So far nothing works and the directory is still not writeable. Where can I go just to see what the new server expects for write permissions to the files it needs permissions to access? These are not problems on the production server.

3
  • Are you on linux envoirnment? Commented Oct 1, 2013 at 15:43
  • Yes, CentOS 6. I'll update the original post.
    – roy
    Commented Oct 1, 2013 at 15:45
  • I suspect this is a dup, but I don't have time to search right now.
    – mpdonadio
    Commented Oct 1, 2013 at 21:46

1 Answer 1

3

The best to fix the permission issue is run the fix-permission script available at https://drupal.org/node/244924

First download the script from here and than run the script as:

sudo bash fix-permissions.sh your/drupal/path your_user_name

Note: The server group name is assumed "www-data", if it differs modify it in the script code

Drupal official doc for file permission is available at https://drupal.org/node/244924


Generally Recommended Permissions for Drupal Files and Folders is following:

drupal/sites/default                                        750
drupal/sites/default/files (including sub folders & files)  755 or 770 *
drupal/sites/default/settings.php                           400 or 440 *
drupal/sites/default/default.settings.php                   400 or 440 *
drupal/sites/all/themes (including sub folders & files)     755
drupal/sites/all/modules (including sub folders & files)    755

* depends on system setup. Some extra modules and/or server rules may require different permissions.

4
  • Thanks, really needed to see the file permission drupal docs. needed to set chmod -R myuser:apache on drupal home folder
    – roy
    Commented Oct 1, 2013 at 16:37
  • 1
    @roy Giving Apache write permissions on the entire site is a huge security risk.
    – mpdonadio
    Commented Oct 1, 2013 at 19:39
  • @MPD had a feeling maybe that would be the case. I'm green, what should I do? it is a test site so it's only accessible from a specific IP.
    – roy
    Commented Oct 1, 2013 at 20:30
  • 1
    @roy The script liked above should work. You just need to also specify the group. CentOS defaults to "apache" instead of "www-data".
    – mpdonadio
    Commented Oct 1, 2013 at 21:45

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.