How do I get Cygwin to create files owned by me, rather than Administrators?

1

1

When I create a file using Cygwin (on Windows 7), the file owner is Administrators. When I create a file with a Windows command shell (same computer, login, etc), the owner is me. How do I get Cygwin to have the owner be me, rather than Administrators?

I've read that Windows has a local security policy that governs whether newly created files are owned by the user who creates them or group Administrators (if the user is a member of group Administrators). How do I change that policy? And why is the Cygwin shell not behaving the same way as the Windows command shell in regard to this policy?

cmessenger

Posted 2013-09-16T13:13:22.047

Reputation: 11

The following article provides details about how Windows decides to set the file owner to Administrators: http://technet.microsoft.com/en-us/library/cc961992.aspx. Let's say my login is chuck. If chuck is in the Administrators group, then Windows will (by default) set the file owner to Administrators. Why, then, when I create a file from the Windows shell, is it owned by chuck, rather than Administrators? I want Cygwin to behave as the Windows shell does.

– cmessenger – 2013-09-17T23:27:58.987

I discovered that there exists a Windows command line utility - whoami.exe - which displays your security access token contents. This could help debug what's going on: run it from a Cygwin shell, then from a Windows cmd shell, and see what, if anything, is different. – cmessenger – 2013-09-18T00:06:56.777

I discovered a Cygwin utility - cygdrop (part of the cygutils-extra package) - whose purpose is to drop specified privileges from the access token in a spawned process. By default, it drops all Administrator privileges. Unfortunately, I found that when I run "cygdrop /cygdrive/c/Windows/System32/whoami.exe /groups", I see that the Administrators group is still in the access token. – cmessenger – 2013-09-18T14:38:25.967

No answers