Ubuntu 12.04 Server: permissions on /var/www for newly copied files

7,379

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:
7,379
Abe
Author by

Abe

Updated on September 18, 2022

Comments

  • Abe
    Abe over 1 year

    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
    
    • Admin
      Admin about 9 years
      you can just give yourself permissions to the wordpress folder like so: sudo chmod -R 777 /var/www/html/wordpress Just watch out. your files might be in a different path. Also, you could really just make this 666, and not 777 if you wanted to :)
    • suspectus
      suspectus about 9 years
      777 permissions would give everyone full access to the site material - not the most secure solution. 666 applied to a directory would prevent the user from entering the directory.