1

As I understand the www-data user is the user that owns the apache service.

From the /etc/passwd file I have:

www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin

So the home dir for www-data is: /var/www but if I check the permissions for that folder I get:

/var/www $ ll
total 12
drwxr-xr-x  3 root root 4096 Mar 20 19:42 ./
drwxr-xr-x 12 root root 4096 Mar 20 19:42 ../
drwxr-xr-x  2 root root 4096 Mar 20 19:42 html/

So it appears that root owns that folder. Why is it not the www-data user that owns the /var/www directory (its home directory)?

3

There's no reason for the webserver to able to write to that directory by default. The administrator should decide which directories and files the webserver should be able to modify, and grant permissions on those accordingly. Having /var/www be owned by root is a safe and secure default.

  • It could lead to problems if you want to upload files e.g. via ftp directly to the folder using a different user (better not root ;) ). – Lord_PedantenStein Sep 5 '16 at 19:48
  • @Lord_PedantenStein then you should modify the permissions accordingly. You don't have a FTP server running by default, do you? – muru Sep 6 '16 at 1:28
  • Nah everything OK back here. ;) - but if someone wants to upload his or her files to that directory something like askubuntu.com/questions/68007/… should be done. regards – Lord_PedantenStein Sep 7 '16 at 23:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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