Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
    
The following article provides details about how Windows decides to set the file owner to Administrators: 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 Sep 17 '13 at 23:27
    
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 Sep 18 '13 at 0:06
    
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 Sep 18 '13 at 14:38

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.