Trying to inherit parent permissions but setfacl doesn't work as intended

2

1

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?

Ryan Mortier

Posted 2015-05-08T16:19:39.080

Reputation: 127

Answers

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.

user49740

Posted 2015-05-08T16:19:39.080

Reputation: 2 850