WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have installed Wordpress on my local Ubuntu machine, with standard LAMP configuration and phpMyAdmin. The installation directory is localhost:///var/www/blog.

At the second step of the installation, after I've entered the MySQL configuration, the following message appeared:

Sorry, but I can’t write the wp-config.php file.

Current permissions are:

-rw-r--r-- 1 adam adam 2.0K Oct 23  2010 wp-links-opml.php
-rw-r--r-- 1 adam adam 3.2K Nov  1  2010 wp-config-sample.php
-rw-r--r-- 1 adam adam 3.7K Jan  8  2012 wp-trackback.php
-rw-r--r-- 1 adam adam  271 Jan  8  2012 wp-blog-header.php
-rw-r--r-- 1 adam adam  395 Jan  8  2012 index.php
-rw-r--r-- 1 adam adam 3.5K Apr 10  2012 wp-comments-post.php
-rw-r--r-- 1 adam adam  20K May  6  2012 license.txt
-rw-r--r-- 1 adam adam  18K Sep 11  2012 wp-signup.php
-rw-r--r-- 1 adam adam 2.7K Sep 11  2012 xmlrpc.php
-rw-r--r-- 1 adam adam 2.7K Sep 23  2012 wp-cron.php
-rw-r--r-- 1 adam adam 7.6K Sep 25  2012 wp-mail.php
-rw-r--r-- 1 adam adam 2.4K Oct 26 21:40 wp-load.php
-rw-r--r-- 1 adam adam 4.6K Nov 17 17:11 wp-activate.php
-rw-r--r-- 1 adam adam 9.7K Nov 22 11:52 wp-settings.php
-rw-r--r-- 1 adam adam  29K Nov 30 15:40 wp-login.php
-rw-r--r-- 1 adam adam 9.0K Jan 24 22:50 readme.html
drwxr-xr-x 9 adam adam 4.0K Jan 24 22:53 wp-includes
drwxr-xr-x 4 adam adam 4.0K Jan 24 22:53 wp-content
drwxr-xr-x 9 adam adam 4.0K Jan 24 22:53 wp-admin
drwxr-xr-x 4 root root 4.0K Apr  1 14:52 ..
drwxr-xr-x 5 adam adam 4.0K Apr  1 14:55 .

I've added a+w permissions to the blog folder:

chmod a+w 

And now everything works, but I don't know if it's safe to grant global write permissions to that folder.

Which file and directory permissions should I set on a new Wordpress/LAMP installation?

share|improve this question

Which file and directory permissions should I set on a new Wordpress/LAMP installation?

There is no definite answer to this. It varies depending on the server setup. The rule of thumb is to use the minimal permission to make WordPress work on a server. This means to start with 400 (or 600) and go from there, until WP works.

share|improve this answer
Rather than try to get the permissions opened up to the point that WP can write to wp-config.php, you can always copy the PHP code that WordPress generates and paste it into your wp-config.php file. – Pat J Apr 1 '13 at 14:43

Related note:

On CentOS and RHEL it can happen that even with the permissions set correctly, WordPress still can't write to either .htaccess or wp-config.php. If this an issue, SELinux might be preventing those writes when set to "enforcing". In which case, change it to "permissive" or turn it off for WordPress to be able to write:

setenforce permissive


setenforce disabled    


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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