Trying to edit settings.php via Cpanel File Manager

I can CHMOD the file to anything I want and back but can't write to it.

I get the following message:

Could not write /home/testing/public_html/sites/default/settings.php: Permission denied

Do you think Apache suEXEC has anything to do with this?

  • This is server side issue not Drupal related. You need to check permission for sites, default and settings.php file. Commented Nov 18, 2013 at 4:59
  • 1
    settings.php is write-protected. You can change the permissions to make it writable, but Drupal will change it back on the first page load, and set it write-protected again. So you should make any change in the settings.php without visiting your site after changing the permissions.
    – Elin Y.
    Commented Nov 18, 2013 at 5:38
  • sites/default folder permission setting is 555, is that correct? What should it be? Commented Nov 18, 2013 at 6:02
  • @ShaneHouston ask your sysadmin. Webserver that runs Drupal must be able to enter it and all it's subfolders, read everything there, and write & delete in files subfolder. How to set that up depends on your server's configuration.
    – Mołot
    Commented Nov 18, 2013 at 8:58
  • sites/defualt permission should be 755 Commented Nov 18, 2013 at 9:42

4 Answers 4


As others have mentioned, you must set the permissions on the /sites/default folder. The default permissions are set to 0555, set them to 0755 for editing. Don't forget to restore the default values afterwards!

  • Thanks, I had to set permission 755 on sites folder first, then the default and finally on the files in it in order to be able to delete it all.
    – Lumis
    Commented Nov 19, 2014 at 23:07

I will recommend to download the file on your local system if you can. Right click on the settings.php file and select Properties from the list. Uncheck the Read-only from Attributes. Click apply button and click OK. Make changes and upload the file back to the server.

NOTE: After editing the file Check the Read-only attribute before uploading.

enter image description here

  • Works. Remember that Drupal add Read-only back again as soon as Drupal is refreshed. Commented Mar 22, 2022 at 9:16

You can edit the permissions of the folder it self. The folder "default" set to 0555, set them to 0755 for editing. Don't forget to restore the default values afterwards!


To prevent this issue in the future, add the following line to your settings.php file:

$settings['skip_permissions_hardening'] = TRUE;

This will prevent Drupal from re-enabling the read-only status of the /sites/default directory and the settings.php within. Drupal will no longer configure the permissions itself.

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.