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

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.

  • 1
    Check this askubuntu.com/questions/348427/… Nov 17, 2013 at 12:40
  • @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?
    – user199622
    Nov 17, 2013 at 12:45
  • Is apache running as www-data? What's the output of ps axu | grep -E 'apache|www-data|http'?
    – Braiam
    Nov 17, 2013 at 12:50
  • @user199622 "solved" in the title is not needed; the acceptance of the answer is all we need ;)
    – Rinzwind
    Nov 17, 2013 at 12:58

1 Answer 1


Try with:

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

Replace [USER NAME] with appropriate.

  • 1
    @elboletaire Yes I typed capital R :)
    – user199622
    Nov 17, 2013 at 12:55
  • @ elboletaire. You have done a good job. I have done a mistake.
    – user224082
    Nov 17, 2013 at 12:58
  • 1
    or sudo chown -R $USER:$USER /var/www Aug 24, 2021 at 13:14

Not the answer you're looking for? Browse other questions tagged .