Drupal 7 and 6 come with a sample configuration file at
Drupal 8 comes with an additional configuration file
Before you run the installation script, you need to copy the configuration file as a new file called
settings.php and change its permissions. After the installation, you need to restrict the permissions again.
In Drupal 8 you need also to copy the services file to
services.yml and change its permissions.
Note: On some types of shared/local hosting for Drupal 7, PHP and Apache are run by the same user. In that case, the Drupal install script attempts to execute the first three steps for you. If you get errors referring to the Settings file during installation, you need to perform the steps described above manually.
Preparing files and permissions
Create settings.php (and services.yml)
default.settings.php file and save the new file as
settings.php in the same directory. To do so, run the following command from the directory that contains your Drupal installation files:
cp sites/default/default.settings.php sites/default/settings.php
Note: Do not simply rename the file. The Drupal installer needs both files.
For Drupal 8, repeat this with the
Change the permissions during the installation
Change the permissions of
settings.php (and in Drupal 8 of
services.yml) to allow the install script to edit the file:
chmod a+w sites/default/settings.php
chmod 666 sites/default/settings.php.
Note: In case you are in the same group as the web user, then changing the permissions to with
664 will be sufficient.
Several FTP tools like Filezilla, Transmit, and Fetch allow you to change file permissions, using a 'file attribute' or 'get info' command. In this case the file permission should be set to 666. If your FTP client has checkboxes for setting permissions, check both the Read and Write boxes for "Owner", "Group", and "Others" (but leave the Execute boxes unchecked).
Create the files directory
Change the permissions of the
sites/default directory to allow the install script to create a files directory
chmod a+w sites/default.
Alternatively, you can create the
sites/default/files directory yourself, and give the webuser permissions to write to it.
Permissions after installation
After the installation script has run, Drupal sets the permissions automatically to 444 (read-only) for the settings.php, and 555 (read-execute) for the default folder. This is correct, and should not be changed, as changing these opens up a security risk.
Re-setting the permissions (D8) [Note - needs confirmation]
After the intallation script has run, you need to set the permission for service.yml in Drupal8.
For Drupal 8 set
chmod 644 sites/default/services.yml