Grant write permissions on the configuration file
Last modified: November 2, 2009 - 11:29
Drupal uses a configuration file for database information and other special configurations.
Your Drupal download comes with a default configuration file at sites/default/default.settings.php, within the Drupal directory that you downloaded the Drupal files to (following the downloading instructions from the previous page), which needs to be prepared so that the installer can edit it.
- Copy the
default.settings.phptosettings.php. You can do this from the command line usingcp default.settings.php settings.php. NOTE: Do not simply rename the file. The Drupal installer will need both files.
cp sites/default/default.settings.php sites/default/settings.php - You should now have both a default.settings.php and settings.php file in your
sites/defaultdirectory. - Make the settings file writeable, so that the installer can edit it
chmod a+w sites/default/settings.php
or
chmod 666 sites/default/settings.php
Both commands have the same effect.
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 octal or numeric value file permission should be set to 666. - Drupal should set the file permissions back to read-only once the installation is done. You should make sure this is the case and manually change it yourself if it didn't happen. You can use the same command, slightly modified, to remove write permission:
chmod a-w sites/default/settings.php
or
chmod 444 sites/default/settings.php. If you are using a FTP tool the permission should be set to 444.
Windows note
On a Windows system this would be Change permission and make sure the file is not marked Read Only before running the installer and then set it back to Read Only after. For more information about modifying Windows file permissions, see the Troubleshooting FAQ.

permissions script on linux
here is a bash script i made to automatically set the permissions in a drupal install for me. the script must be run from the root of drupal install directory. you should also give an argument stating which sites folder you would like to set the permissions for, otherwise it will default to the sites/default directory.
make sure to make the script executable
sudo chmod +x drupal_permissions.shex:
sudo ./drupal_permissions.shwill set all permissions on all files in the drupal dir, and the files dir under the sites/default directory
ex:
sudo ./drupal_permissions.sh domain.comwill set all permissions on all files in the drupal dir, and the files dir under the sites/domain.com directory
add this to a file called "drupal_permissions.sh" and place it into your drupal dir or somewhere outside of drupal root and make a link to the usr/bin like so:
sudo ln -s /path/to/drupal_permissions.sh /usr/bin/drupal_permissionsnow you can run the command from any drupal dir without having to move the script
and the script:
#!/bin/bash
# bash script created by Shawn "bigmack83" McElroy.
# You can contact me at: smcelroy [at] shamce [dot] net
# drupal.org profile: http://drupal.org/user/248940
# Im also on irc.freenode.net on #drupal-support
# DISCLAIMER: you can use this file however you want, I take no responsibility on the effects it may have on your system. If you redistribute this file please leave these coment lines in tact to give credit where credit is due.
# Note: these script will be posted on my site soon rather than here
### remember to configure the script before running
# set to your username
user="user-name"
# set to the username that your webserver uses, such as www-data, httpd, nginx, etc...
server="www-data"
# set to the user group that manages all your drupal files such as drupal, developer, etc...
group="drupal"
# sets argument 1 to "default" if not given as an argument. to add your own run the
# script with the name of the multi sites folder you want to change permissions for
# ex: sudo ./drupal_permissions.sh domain.com
# to change the perms od drupal and the sites folder sites/domain.com
site=${1:-'default'}
##### END configuration
##### begin script. no editing below this is neccesary
# add group to system
echo "adding ${group} group"
groupadd ${group}
echo "setting overall permissions"
find . -type d -exec chmod -R 1775 \{\} \;
find . -type f -exec chmod -R 1664 \{\} \;
chown -R ${user}:${group} *
echo "looking for settings files and setting perms ..."
find . -name "settings.php" -type f -exec chown -R ${server}:${group} \{\} \;
find . -name "settings.php" -type f -exec chmod 444 \{\} \;
find . -name "default.settings.php" -type f -exec chown -R ${server}:${group} \{\} \;
find . -name "default.settings.php" -type f -exec chmod 444 \{\} \;
echo "setting files dir perms"
# multisites directory. ex: sites/domain.com
cd sites/${site}
chown -R ${server}:${group} files
chmod -R 1770 files
cd ..
echo "all done"
-----------------------------------------------------------------------------------------------------------
"The level of our success is limited only by our imagination" -Aesop
What? no "I attend local Drupal User Group" setting in profiles?
Change Permissions to write on settings.php file
I just install Drupal 6 on using XAMPP on a Windows XP Pro machine and had trouble getting past the change permissions on settings.php file. I found that when I copied the default.settings file and renamed it to settings.php , it automatically named the file as settings.php.php
To get around this problem, I just renamed the file setting without adding the .php extension and then clicked on the try again button on the installation page and it worked just fine. If anyone else is having trouble changing the file permissions to write, try this and see if it works for you.
Mordeals
Install on fedora 12
Missed something in the fedora specific documentation. By default drupal looks for /etc/drupal/default/files/settings.php. This is blocked by selinux.
login as root
copy settings template to var drupal folder
cp /etc/drupal/default/default.settings.php /var/lib/drupal/files/default/settings.php
set selinux type
chcon -t httpd_var_lib_t /var/lib/drupal/files/default/settings.php
create a symlink from etc folder to var folder
ln -s /var/lib/drupal/files/default/settings.php /etc/drupal/default/settings.php
then start setup by pointing the browser at http://localhost/drupal