Linux directory permissions for different groups

前端 未结 4 571
野的像风
野的像风 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:33

    There are two problematic things in your approach. The first one is:

    chgrp god public private
    chgrp pub public
    

    With second command, you discarded the effect of the first one. Directory public now belongs to pub group, not to god anymore.

    The second thing is that you probably didn't give write permissions on directory public to group that owns it (the fact that the user executing the command touch belongs to directory's group doesn't matter).

    Try this:

    chmod 770 public
    

    and do similar with other directories. However, what you're initially trying to achieve is impossible because the directory can belong to one group only. Nikos elaborated it well in his answer - place user in more groups.

提交回复
热议问题