/var/www permissions

Hi

I installed lighttpd. Then I want to give to user "xxx" the permissions to upload in the directory /var/www/foobar.com/htdocs.

So my commands were:

chmod g+w .

chmod -R g+rw /var/www

chown www-data:xxx /var/www/foobar.com/htdocs

but any file I create in the directory from my user can't be read from the web server.

If I give:

chmod www-data:xxx /var/www/foobar.com/htdocs

I can't do anything in the directory

if I give:

chmod xxx:www-data /var/www/foobar.com/htdocs

the web server can't read the content in it.

What would you advise?

2 Replies

What is the group ownership for the files you create as user xxx? If it's not www-data, then the server won't be able to read them; you need to chgrp www-data filename … them.

Note that having your web directories/files writeable by the web server is a potential security risk.

You could add user www-data to group xxx and set all the files under foobar.com/htdocs to be owned by xxx:xxx. You'd have to restart lighttpd to get the group permissions working. That would give your xxx user the ability to edit their content and give lighttpd access to the content through the xxx group.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct