-1

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.

  • 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
1

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.

| improve this answer | |
  • 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.