Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I ran the following commands to set up ACL on the /var/www folder in my Ubuntu 12.04 Server:

sudo usermod -g www-data abe
sudo chown -R www-data:www-data /var/www
sudo chmod -R 775 /var/www

I downloaded Wordpress using wget in my /var/www folder and unzipped the downloaded file:

cd /var/www
wget http://wordpress.org/latest.zip
mv latest.zip wordpress.zip
unzip wordpress.zip

I created a new database and user in mysql and attempted to run the setup process through the web interface.

When I enter the configuration info in wordpress I run into the following error message: Sorry, but I can't write the wp-config.php file.

When I run ls -la, I see that the files are owned by my user abe, but they are part of the group www-data.

Would I have to run the chmod command every time I copy new files to /var/www?

sudo chmod -R 775 /var/www
share|improve this question

4 Answers 4

just go to wordpress installation directory inside your www directory in terminal and give write permission to your web server which is running as www-data

sudo chown -R www-data wordpress
share|improve this answer

When you unzip files they come with their own permissions thus you need to edit permissions. But you could write a shell script which will do all processes for you.

share|improve this answer

WP-config.php ins't saved in root I think.

Try doing this: chgrp -r www-data wwww/ and then chmod -r g+w www/ It will change group recursively, and then add Write permissions to Group, also recursively.

share|improve this answer

Be aware that you're not dealing with ACL here, just basic permissions and membership.

Here you can:

  • Use the www-data account to perform tasks on /var/www (using sudo -u www-data [command] for example).
  • Use umask 002 which will creates directory with 775 and file with 664 permissions (if it is not the case already, otherwise you don't have any problem here).
  • Use real ACLs (if enabled on your filesystem), for example find /var/www -type d -exec setfacl -m d:g:www-data:rwX {} \; which will create a default ACL (d:, so it will be inherited), recursively on directories (find -type d), with read-write access (rw) on all content and execute access (X) on directories, to the group (g:) www-data. You might also add this ACL on all already-created files : setfacl -R -m g:www-data:rwX /var/www.

For the last two points, it's recommended that you know what you're doing, otherwise you could create a big mess in filesystem permissions if something goes wrong.

share|improve this answer

Your Answer

 
discard

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.