Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

If I copy a file with a base ACL of:

u::rw-,g::r--,o::r--

into a directory with a default ACL of:

u::rwx,g::r-x,g:users:rwx,m::rwx,o::r-x

I obtain a file with mask of m::r--. I would have expected the union of the permissions of the two group entries (i.e. m::rwx).

Why it is so? Does it depend on the mode parameter used by cp in the creation of the file?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

(I assume you're working on Linux, the workings of ACLs differ between unix variants.)

cp doesn't do anything special when you copy the file; it creates the file with the mode of the original file, masked by the mask of the directory. Since cp doesn't do anything to the file's mask, the mask ends up being the intersection of the directory mask (rwx) and the file's group permissions (r).

open("dir/file", O_WRONLY|O_CREAT|O_EXCL, 0644)
share|improve this answer
    
When one has set the default ACL (which is passed on to newly created subfolders), how does the mask + default acl + folder perms get fused together, when a new subfolder is created??? –  nass Aug 6 '13 at 12:03
    
@nass The default ACL is used if no ACL has been set explicitly. If there's an explicit ACL then its mask is used, otherwise the default mask is used. –  Gilles Aug 6 '13 at 12:08
    
I am abit fuzzy about the mask acl. if I set an explicit acl to a folder, I expect this to be followed. you tell me that regardless of my explicit acl, the actual perms will be the intersection of the mask with the acl? and when I set a default acl then that is taken as is (ie without intersection with the mask acl?) may I also refer you to a question I have here unix.stackexchange.com/questions/85633/… –  nass Aug 6 '13 at 12:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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