Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm quite new to Ubuntu and Linux in general.

I need to create a my www directory (in /home) and set the permissions/ownership correctly so that any new files and directories created by myself (via terminal etc, username is matt) OR the web server (Nginx in this case) are owned by matt:www-data. I believe I need to do something with setfacl but I'm not sure how to do it correctly.

Thanks in advance.

share|improve this question

For setting www, I usually set ownership first, in this case I use your username 'matt' and the directory that I use /var/www/. Make sure that your username is member of www-data group, if not, you can add sudo adduser matt www-data

sudo chown matt:www-data -R /var/www

The second thing, we should set permission

sudo chmod 0755 -R /var/www
sudo chmod g+s /var/www
share|improve this answer

As far as I remember, it was enough to set the read flag on the files you want your web server to be able to display and open.

share|improve this answer

Your Answer


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.