I want to know how I can make a file in /opt/, that will be owned by 2 users and 3 groups, and others should not able to access it.

closed as unclear what you're asking by Jeff Schaller, maulinglawns, icarus, Christopher, roaima Dec 29 '18 at 22:22

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 5
    A file has exactly one owner and one group. You may mean "can be accessed by two users and three groups". If this is an assignment, please give us the complete text so that the question will be clear. – Mark Plotnick Dec 29 '18 at 16:32
  • 3
    Interestingly, unix.stackexchange.com/questions/491492 , asked a mere hour later, is talking about much the same goal with simply a different directory name. – JdeBP Dec 29 '18 at 17:09
  • 1
    You need file access control (setfacl). see unix.stackexchange.com/q/101263/4778 – ctrl-alt-delor Dec 29 '18 at 17:58

ACL is another great way for access control.
In my opinion you can include your 2 users to a particular group and grant chmod 770 to that /opt directory, where 0 means no privileges to others.

  • While that's a great suggestion, it's not an answer. A file in Linux can't have two owners. – tink Dec 29 '18 at 18:56

Not the answer you're looking for? Browse other questions tagged or ask your own question.