Tell me more ×
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.

I've just successfully installed lighttpd, but I've stumbled at the first stage when trying to create my own HTML file. I try to write to /var/www but I get permission denied. I've got a feeling it's to do with the ownership of /var (root:root), but I don't want to change this as there are plenty of other sub-directories in there besides www.

Ownership:
/var root:root
/var/www www-data:www-data

My user pi is also in the www-data group. How can I sort this out?

Edit

pi@Sun:~$ ls -la /var/www   
total 12   
drwxr-xr-x  2 www-data www-data 4096 Jul 20 19:23 .  
drwxr-xr-x 14 root     root     4096 Jul 20 19:23 ..  
-rw-r--r--  1 www-data www-data 3585 Jul 20 19:23 index.lighttpd.html  
share|improve this question
I've left mine as they are, and use sudo to edit files where necessary. Can see that that might be a pain if you're actually coding a site though. – Jon Egerton Jul 20 '12 at 23:06
2  
Can you edeit your answer to show us the output of groups pi and ls -la when run from /var/www? – Steve Robillard Jul 21 '12 at 0:38
This is unanswerable unless you show the output of ls -la /var/www/ – Jivings Jul 21 '12 at 11:10
2  
serverfault.com/questions/6895/… summarizes it very well. – Tibor Jul 21 '12 at 11:28
Added output from ls -la. – Mark Ingram Jul 27 '12 at 22:40

1 Answer

up vote 6 down vote accepted

So, www-data is the owner and owning group of /var/www. That doesn't mean anyone in the www-data group can write to /var/www.

You still need to give them write access:

sudo chmod g+w /var/www
share|improve this answer
Is www-data a user or a group? – Alex Chamberlain Jul 21 '12 at 14:00
   
@AlexChamberlain: Both. – Oliver Salzburg Jul 21 '12 at 14:03
Users are groups - can you add another user to a group which is a user? – Alex Chamberlain Jul 21 '12 at 14:04
@AlexChamberlain: "Users are groups"? This is news to me, or I'm misunderstanding. – Oliver Salzburg Jul 21 '12 at 14:42
Can you explain what g+w does? – Mark Ingram Jul 24 '12 at 10:36
show 1 more comment

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.