Linux directory permissions for different groups

前端 未结 4 564
野的像风
野的像风 2021-01-31 23:21

I\'m having two directories: \"public\" and \"private\". I have three users: \"chris\", \"john\", \"dan\". I have two groups: \"pub\", \"priv\" and \"god\".

  • The g
4条回答
  •  遥遥无期
    2021-01-31 23:35

    You said that the group "pub" should be the only group to have permissions over "public". But right before that you said that "god" should also have access. So "pub" can't be the only one that has access. Ditto for "priv".

    You also say:

    I have two groups: "pub", "priv" and "god".

    Well, that's three groups. (Reminds me of that famous quote: "There's three kinds of people in this world; those who can count and those who can't." :-P)

    Your base concept seems wrong. The way this works is rather simple. Create two groups, "pub" and "priv". Place all users who need access to the directories accordingly. Users who need access to both directories should belong to both groups.

    In this case, "chris" should be put in both the "pub" as well as the "priv" group. "john" should be put in the "pub" group. "dan" should be put in the "priv" group.

    What you were trying to do is having the directories be owned by two groups. That's not possible. It's users who can be part of multiple groups, not files or directories. You simply got it backwards :-)

提交回复
热议问题