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: Setting cygwin permissions from Windows programs

On Tue, 20 Dec 2005, Steve Holden wrote:

> Larry Hall (Cygwin) wrote:
> > Steve Holden wrote:
> >
> > > I am writing a Python program to generate file trees to be
> > > distributed to a Linus machine using Cygwin's scp. As the GUI to
> > > this program uses wxPython, a native Windows approach is the most
> > > straightforward.
> > >
> > > Is there any way to set permissions on the output files from the
> > > Windows side that will result in predictable permissions when the
> > > output tree is viewed from Cygwin?
> > >
> > > A Python recipe would be useful, but I'll take what I can get!
> >
> >
> > Have you checked what the permissions on a file you created by Windows
> > looks like under Cygwin and seen some problem?  If so, please post the
> > details and perhaps someone can help.  Otherwise, I'd suggest just
> > doing the above and working with the result unless you see problems.
> > In general, unless you've done something to restrict access in
> > Windows, Cygwin can see and interact with "natively created" files
> > just fine.
> Holger Krull wrote:
> > Cygwin doesn't have an own management of permissions. So any program
> > that modifies permission in Windows will be able to change permissions
> > for cygwin files. cacls and xcacls are command line tools from
> > windows. Don't know how this would be usually done in python.
> Thanks for the responses. The issue is that I'd like the files to appear in
> Cygwin with permissions of -rwxr--r--, or -rwxr-xr-x for executables and
> directories.
> I'm trying to avoid having to use Cygwin utilities to assert Cygwin
> permissions, but I am unable to determine the Windows permissions I must
> assert when creating the files in order for Cygwin to see those
> permissions. Currently a newly created file appears as:
> -rwx------  1 sholden None 13834 Dec 20 14:26 index.html
> This is under Win XP. Are the Cygwin and Windows permissions different
> universes that don't interact?

To clarify what Holger said: on NTFS, Cygwin does not do its own
permission management -- it uses the ACLs on the underlying filesystem and
maps them to Unix-style permissions.  You can experiment with this mapping
by playing with the Cygwin getfacl/setfacl tools (or use cacls, but I
found the getfacl output much more palatable).  Once you understand how
the mapping works, you can change the ACLs appropriately to get the right
Unix permission bits from Cygwin.

FYI, on FAT filesystems, Cygwin can emulate permissions using NTEA, but
those will need to be changed via Cygwin itself -- Windows won't know
anything about them, and so none of the pure Windows tools can be used to
change them.
      |\      _,,,---,,_
ZZZzz /,`.-'`'    -.  ;-;;,_
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte."
"But no -- you are no fool; you call yourself a fool, there's proof enough in
that!" -- Rostand, "Cyrano de Bergerac"

Unsubscribe info:
Problem reports:

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