0

This is my first time configuring a lamp stack and I'm running into lots of problems with permissions. Here's an example of one of the errors

The specified file temporary://fileChLMzd could not be copied, because the destination directory is not properly configured. This may be caused by a problem with file or directory permissions. More information is available in the system log.

When I go to reports / recent log messages, this is all I can find:

REFERRER http://localhost/boilerplate/public/admin/reports/dblog MESSAGE File temporary://fileChLMzd could not be copied, because the destination directory public://js is not configured correctly.

I use to get a lot more of these errors when I had my temp directory inside of the apache installation, but I've since moved it to /tmp, which got rid of a lot of errors.

I've currently got my entire sites/default/files folder set to 777 with www-data access, which doesn't feel safe.. is this right?

Should everything else be set to have root access, like it currently is, instead www-data?

Stuff that I'm using:

Ubuntu 14.04
Apache2
MySQL
PHP 5.5
Drush status:
Drupal version : 7.41
Site URI : http://default
Database driver : mysql
Database hostname : localhost
Database username : admin
Database name : boilerplate
Database : Connected
Drupal bootstrap : Successful
Drupal user : Anonymous
Default theme : boilerplate
Administration theme : seven
PHP configuration : /etc/php5/cli/php.ini
Drush version : 5.10.0
Drush configuration :
Drupal root : /var/www/html/boilerplate/public
Site path : sites/default
File directory path : sites/default/files
Private file directory path : /var/www/html/boilerplate/private Temporary file directory path : /tmp

1

You should never give the files directory 777 permissions unless your workin on a local machine. Still then it is bad practice.

Every file in the system needs to be readable by the system user your webserver is using. Every directory should be readable, writable and executable by the same user. The same could be said for the webserver group.

I always set the user to my local user and the group to a group that is readable by my user account & the webserver account. The files directory (and his subdirectories) could be set to a simple 775 so the user and the group have permissions to it. All other users should only be able to read & execute the directory. As for the files inside the files directory, they should be readable and writable to the local user and the webserver group & only readable for all other users. They should be set to 664.

The same could be said about your private directory, which I just noticed in your error post.

  • Thanks, this is pretty much what I was looking for. What's the rationalization for 664 though? ie: What's the significance in blocking execution, while allowing both read and write? – architarious Nov 19 '15 at 3:51
  • Glad to be able to help! I hope read is obvious. Anyone should be able to read a file to be able to open it. As for write, some files are cached by Drupal in the files directory and therefore need to be able to be overwritten. Only files that need to be able to do something (install something, copy something) need the executable permission. Only the files in the scripts directory in your site root may need that permission, but they are only used by developers, not by Drupal itself. – absoludo Nov 19 '15 at 9:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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