4

When I try to add "Public file system path" and "Private file system path" in Administration > Configuration > Media > File System in my drupal site, I get "The directory sites/default/files exists but is not writable and could not be made writable" Error. But it is working fine in localhost.

The permission for the folders is 755, I changed it to 777. But still it didnt work.

I also changed the owner following some blogs using: chown -R apache:apache private

But it didnt help either.

Please Help. Thanks in advance.

enter image description here

Aasim Hussain Khan
  • 1,137
  • 3
  • 15
  • 33

4 Answers4

1

Try to replace .htaccess in sites/default/files with the original one or

try to remove .htaccess in sites/default/files or

try to change .htaccess in sites/default/files from Options None Options +FollowSymLinks to #Options None #Options +FollowSymLinks

You could try same with .htaccess in Drupal root

Paul Bönisch
  • 294
  • 2
  • 10
1

I am too late for this answer but may help someone who searches for it.

If SELinux security is enabled and there is not a "rw" in the context for the files/ directory it will not be writable no matter which group, user, or Unix permissions are granted.

To see these "hidden" settings:

ls -laZ sites/default

drwxr-sr-x. apache www unconfined_u:object_r:httpd_sys_content_t:s0 .
drwxr-xr-x. apache www unconfined_u:object_r:httpd_sys_content_t:s0 ..
-rwxr-sr-x. apache www unconfined_u:object_r:httpd_sys_content_t:s0         default.settings.php
drwxrwsr-x. apache www unconfined_u:object_r:httpd_sys_content_t:s0 files
-rwxr-sr-x. apache www unconfined_u:object_r:httpd_sys_rw_content_t:s0 settings.php

To change the settings on files/ so it is writable:

sudo chcon -R -t httpd_sys_rw_content_t files

When the install is done reset the context using the same command with the original "http_sys_content_t" context.

FYI - This command will also be necessary to enable writes when installing themes under the "all" directory.

jayaprakash R
  • 152
  • 3
  • 13
0

Probably you need to run restorecon on the directory for eg:

restorecon -rv default/
Dhruv Tyagi
  • 814
  • 1
  • 9
  • 28
0

chmod -R 777 sites/default/files/

^ worked for me, however I had no private file system path.