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.

  • If I'm not mistaken, the classic group-based permissions in Linux do not allow you to put a group inside another group. So did you installed something which enables this feature? Sep 9, 2012 at 20:47
  • A User can be a member of several groups. If you add User1 to group2 he is able to change File2. The command of your choice would be useradd. Sep 9, 2012 at 21:49
  • @GuntherStruyf I didn't change anything... From what I could tell, Ubuntu allows it by default... Sep 9, 2012 at 22:14
  • @user1146332 The whole point is to not add user1 to group2. If that is the only way then I can do that, but theoretically I'd prefer a group nesting structure... Sep 9, 2012 at 22:17

1 Answer 1


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 lists group1 as a member of group2, it designates the user called group1 (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:

  • Make file2 world-accessible (you probably don't want this)
  • Make user1 the owner of file2: chown user1 file2
  • Add user1 to group2: adduser user1 group2
  • Add an ACL to file2 that grants access to either user1 or group`:

    setfacl -m user:user1:rw file2
    setfacl -m group:group1:rw file2

    See Make all new files in a directory accessible to a group on enabling ACLs.

  • 12
    Yep, unix/linux doesn't support nested groups. It would be usful if it did, but it just doesn't. Windows does, and Active Directory does. LDAP does too, so it should be possible if the account and group data is in LDAP rather than in /etc/passwd and /etc/group files...but that's overkill when there are simple solutions like ACLs (or just add the user to both groups)
    – cas
    Sep 10, 2012 at 2:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .