I was so sure of myself, I thought I knew about permissions. Until someone asked me this.

Having these users:

User   Group
----   -----
juan   juan
pedro  pedro
maria  maria
jose   jose
miguel miguel
eric   eric
lola   lola
paola  paola       

This directory: /opt/privado with Owner = juan:juan


juan 111
pedro  110
maria and jose 101
miguel and eric 100
lola   000

There are no common permissions for creating a group myGroup and assigning, for example, 110 because I have different permissions for a different group of users. How can this be done on Unix? Really the issue is for Linux, but maybe it is the same solution.


You want to use POSIX ACLs for this, if you can't create sensible groups. See the setfacl command.

  • I agree with @geekosaur. Also check the man pages for acl(5) and getfacl(1). – jsbillings May 4 '12 at 22:08

Unix allows one set of mode bits per file. On traditional implementations of Unix, you can control access by the owner, owner's group, and others — and that's it.

If you have a recent Unix (including Linux), you can use ACLs to solve this problem:

setfacl -m u:juan:7 -m u:pedro:6 -m u:maria:5 \
    -m u:jose:5 -m u:miguel:4 -m u:eric:4 -m u:lola:0 /opt/privado

You can then view the ACL with:

getfacl /opt/privado

POSIX ACLs are very powerful, yet pretty obscure in most circles. Check out the manpages for more information.

  • 1
    @geekosaur answered this while I was typing my answer (and got my vote too as a result). – Alexios May 4 '12 at 22:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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