I have set up 4 websites inside the /var/www/html/ folder.

  • hbf-server
  • hbf
  • tf
  • 2e

The account I use to access the server is through my account harleyfrank.

Now the permissions are root:www-data with 755 and supposed to be recursive. However, when uploading data from my account harleyfrank, it just sets permits for me, and I get an apache error because of the permissions.

I followed these websites:

But the weird thing is that it is applying harleyfrank:www-data with read-write permissions only to harleyfrank. I am not sure how to get it fixed.

Update 1-15-2018

Following George's answer, I tried to do a global set sudo setfacl -d -R -m u:root:rwx,g:www-data:rw,o::r /var/www/html however, it's not applying the permissions. It is still only using my username when uploading files.

Here is what the permissions are set by the ACL:

getfacl: Removing leading '/' from absolute path names
# file: var/www/html
# owner: root
# group: www-data

In one of the web folders I did ls -la and here are the results.

drwxrwxr-x+ 3 root        www-data    4096 Jan 15 19:52 .
drwxrwxr-x+ 6 root        www-data    4096 Jan 12 21:35 ..
-rwxrwxr-x  1 root        www-data     169 Jan 12 22:05 index.html
drwxrwxr-x+ 9 root        www-data    4096 Jan 12 23:16 projects
-rw-rw-r--+ 1 harleyfrank harleyfrank  871 Jan 15 19:52 test_results.txt

I uploaded test_results.txt, and it is not reading within apache as it says I do not have permissions to view the file. However, it shows read permissions in the other's group. Maybe apache2 is running everything with www-data?

  • You will need to use setfacl to set the permission and ownership permanently Jan 13, 2018 at 23:32
  • I did this on every folder. For user group and other. sudo setfacl -d -m o::rwx -R /var/www/html/2e Jan 13, 2018 at 23:39
  • 1
    Please see my updates to that command and be more explicit in your request. I have updated it so your the owner and the group is www-data. Jan 16, 2018 at 4:58

1 Answer 1


To fix it use the setfacl comamnd to set the permissions and default owners:

sudo setfacl -d -R -m u:harleyfrank:rwX,g:www-data:rwX,o::r /var/www/html


  • -d: set as default so new folders will inherit it automatically
  • -R: recursive
  • -m: modify existing permissions and ownerships
  • u:harleyfrank:rwX: give user root rwx on the folders and files
  • g:www-data:rwX: give user www-data rwX on the folders
  • o::r: give others read rights on folders
  • this will overwrite the chown command i did earlier right on all folders? Jan 13, 2018 at 23:48
  • Yes it will, so modify to get what you want! Jan 13, 2018 at 23:48
  • Thanks for the assistance. How do I remove the setfacl's on the others because in 2e it's still assigning to me and only doing rw. I checked the others and its doing harleyfrank:harleyfrank with read only. Do I have to delete the others and start fresh? Jan 14, 2018 at 0:08
  • what do you want others to be like? Jan 14, 2018 at 0:13
  • I don't mean others like the others group, I was talking about the other folders, if I needed to remove the setfacl I assigned to them in the beginning. I also re-applied that same command and now it is applying the rwx-rw-r but still only for harleyfrank:harleyfrank. Shouldn't it switch to root:www-data? Jan 14, 2018 at 0:15

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.