This question already has an answer here:

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.

share|improve this question

marked as duplicate by Florian Diesch, falconer, Eric Carvalho, minerz029, karel Jan 23 '14 at 1:11

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
Check this askubuntu.com/questions/348427/… – Nikos Grigoriadis Nov 17 '13 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 '13 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 '13 at 12:50
    
@user199622 "solved" in the title is not needed; the acceptance of the answer is all we need ;) – Rinzwind Nov 17 '13 at 12:58
up vote 17 down vote accepted

Try with:

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

Replace [USER NAME] with appropriate.

share|improve this answer
    
Awesome! thx :) – user199622 Nov 17 '13 at 12:51
1  
@elboletaire Yes I typed capital R :) – user199622 Nov 17 '13 at 12:55
    
@ elboletaire. You have done a good job. I have done a mistake. – user224082 Nov 17 '13 at 12:58

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