This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: umask not working?


Ken Brown wrote:
> On 3/21/2018 6:36 AM, David Allsopp wrote:
> > Ken Brown
> >> On 3/19/2018 8:48 AM, David Allsopp wrote:
> >>> Is this expected behaviour:
> >>>
> >>> OPAM+DRA@OPAM ~
> >>> $ uname -a ; umask ; touch /tmp/foo ; ls -l /tmp/foo ; mkdir
> >>> /tmp/bar ; touch /tmp/bar/foo ; ls -l /tmp/bar/foo CYGWIN_NT-6.1-WOW
> >>> OPAM
> >>> 2.10.0(0.325/5/3) 2018-02-02 15:21 i686 Cygwin
> >>> 0022
> >>> -rw-r--r-- 1 OPAM+DRA OPAM+None 0 Mar 19 13:44 /tmp/foo
> >>> -rw-rw-r--+ 1 OPAM+DRA OPAM+None 0 Mar 19 13:44 /tmp/bar/foo
> >>>
> >>> Why does the file /tmp/bar/foo get g+w when /tmp/foo doesn't - I'm
> >>> not sure what to look at on my system to diagnose what I may have
> >>> inadvertently tweaked. The directory itself is:
> >>>
> >>> drwxr-xr-x+ 1 OPAM+DRA OPAM+None 0 Mar 19 13:44 /tmp/bar
> >>
> >> See if this helps:
> >>
> >>     https://cygwin.com/faq/faq.html#faq.using.same-with-permissions
> >
> > Thanks for the pointer. I wonder from it if this could be to do with
> the Cygwin installation being old (but upgraded). I tried on the same
> machine creating another installation to C:\cygwin2 (which behaves as
> Roger Wells noted) and then ran getfacl /tmp on each:
> >
> > Old installation:
> >
> > # file: /tmp
> > # owner: OPAM+DRA-Admin
> > # group: OPAM+None
> > user::rwx
> > user:OPAM+DRA:rwx
> > group::r-x
> > mask:rwx
> > other:r-x
> > default:user::rwx
> > default:user:OPAM+DRA:rwx
> > default:group::r-x
> > default:mask:rwx
> > default:other:r-x
> >
> > Fresh installation:
> >
> > # file: /tmp
> > # owner: OPAM+DRA-Admin
> > # group: OPAM+None
> > # flags: --t
> > user::rwx
> > group::rwx
> > other:rwx
> > default:user::rwx
> > default:group::r-x
> > default:other:r-x
> >
> > I expect that the extra OPAM+DRA:rwx on the old installation was
> manually added by me, years ago. What are the "mask" entries all about?
> >
> > The default:mask entry seems to be the crucial one, as if I do setfacl
> default:mask:rwx /tmp on the fresh installation, then I get the same
> behaviour as on the old installation.
> >
> > However, I'm struggling to find references for either what these mask
> entries are, or how they ever appeared?
> 
> If you search the web for "Posix acl mask" you'll find lots of
> information.  Here's one that seems pretty good:
> 
>    https://cs.unc.edu/help-article/posix-acls-in-linux/

Indeed, I got a lot further once I stopped looking for Cygwin-specific info. The most useful part was eventually finding this in the umask(2) man page (http://man7.org/linux/man-pages/man2/umask.2.html): "Alternatively, if the parent directory has a default ACL (see acl(5)), the umask is ignored". Which explains why I was seeing that behaviour, and it was owing to having added my user account (the OPAM+DRA) to the ACL as that of course added w to the mask.

Thanks for the help!


David


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]