2

I'm running Ubuntu Server 14.04.2 LTS and I've installed acl using sudo apt-get install acl.

I'm trying to create a www folder under /srv that the web server has read/write access to in addition to my user account. I want all future folders and files created under /srv/www to inherit permissions, user, and group.

Here is my progress:

cd /srv

sudo mkdir www

sudo chown -R ryan:www-data www/

sudo chmod -R a-rwx www/

sudo chmod -R ug+rwX www/

sudo setfacl -Rdm u:ryan:rwX,g:www-data:rwX www/

getfacl www/

Output:

# file: www/
# owner: ryan
# group: www-data
user::rwx
group::rwx
other::---
default:user::rwx
default:user:ryan:rwx
default:group::rwx
default:group:www-data:rwx
default:mask::rwx
default:other::---

Problem is, whenever I create a new file or folder in www/ the permissions are inherited but not the owner or group. How do I get the owner and group to inherit? I thought specifying a user or group between the colons :[user or group]: would cause them to be inherited?

0

Specifying a user/group between the colons means that those permissions apply to that user/group. So, for example, you can have a folder mode 0600 but readable by some random user via a user:user:randomuser:rwx ACL.

You can chmod g+s /srv/www to make files/folders inherit its group. You cannot inherit the user on Linux (on some systems chmod u+s /srv/www would do that) . Usually you have no need to, as you can use ACLs to grant any permissions to any users/groups you want.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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