Permissions and ownership of /var/www

257,801

Try with:

sudo chown -R [USER NAME]:[USER NAME] /var/www

Replace [USER NAME] with appropriate.

Share:
257,801

Related videos on Youtube

user199622
Author by

user199622

Updated on September 18, 2022

Comments

  • user199622
    user199622 almost 2 years

    I am using Ubuntu 13.04 VPS and have installed LAMP (apache2). Now I have uploaded my web files (WordPress) in /var/www. But I dont have permissions to write in files.

    When I run WordPress install, it says that it could not write on wp-config php file. So I execute this command over SSH

    su
    cd /var/www
    sudo chown www-data:www-data -R *
    /etc/init.d/apache2 restart
    

    (www-data is my apache user).Still itv cant write into files. I also cannot upload files using FTP (transfer failed error).

    The permissions for directories in /var/www are 755 and for files are 644. Setting permissions 777 resolves the problem but I dont want to CHMOD it 777.

    Please help me out.. Thx.

    • Nikos Grigoriadis
      Nikos Grigoriadis over 10 years
    • user199622
      user199622 over 10 years
      @Nikos Yes I saw that. It told to change owner to whoami:whoami (root:root) but the web files must be owned by Apache user. Isn't that?
    • Braiam
      Braiam over 10 years
      Is apache running as www-data? What's the output of ps axu | grep -E 'apache|www-data|http'?
    • Rinzwind
      Rinzwind over 10 years
      @user199622 "solved" in the title is not needed; the acceptance of the answer is all we need ;)
  • Nick Aumar
    Nick Aumar over 10 years
    @ elboletaire. You have done a good job. I have done a mistake.
  • Rafique Mohammed
    Rafique Mohammed almost 3 years
    or sudo chown -R $USER:$USER /var/www