I tried finding this on here, but couldn't so sorry if it's a duplicate.
Say I have 2 groups and a user: group1, group2, user1
with the following structure: group1 is a member of group 2, user1 is a member of group1
Now say I have the following files with relevant permissions
file1 root:group1 660
file2 root:group2 660
Now when I log into user1, I'm able to edit file1, but not edit file2. Short of adding user1 to group2, is there any way of doing this? or is there no way?
I'm using Ubuntu btw.
Best Answer
There is no such thing as a group being a member of a group. A group, by definition, has a set of user members. I've never heard of a feature that would let you specify “subgroups” where members of subgroups are automatically granted membership into the supergroup on login. If
/etc/group
listsgroup1
as a member ofgroup2
, it designates the user calledgroup1
(if such a user exists, which is possible: user names and group names live in different name spaces).If you want user1 to have access to file2, you have several solutions:
file2
world-accessible (you probably don't want this)chown user1 file2
adduser user1 group2
Add an ACL to
file2
that grants access to either user1 or group`:See Make all new files in a directory accessible to a group on enabling ACLs.