Question about UAC and bash/cygwin

Christian Franke
Thu Aug 16 19:26:00 GMT 2012

Corinna Vinschen wrote:
> On Aug 16 07:06, Lord Laraby wrote:
>>   My, major emphasis is recognizing in the Cygwin dll
>> or startup code somewhere) that the user has full Administrator rights
>> and simply replacing his normal UID with 0 (or that of whomever root
>> seems to be by /etc/passwd). Internally (at cygwin.dll level) he/she
>> is still the same user, but the desired effects would be that bash and
>> others might change his prompt to '#' and that scripts can check for
>> admin rights and files he/she created would become owned by UID 0 (or
>> the Administrators group).
> What is it good for to have uid 0?  You want to know if you have admin
> rights, so why don't you simply check for the admin group in the
> supplementary group list?
> Here's what I do in my tcsh ~/.cshrc profile to set the prompt:
>    id -G | egrep -q '\<544\>' && set prompt = '#  || set prompt = '\$ '

I use this simple check which does not depend on /etc/group contents:

  test -r /proc/registry/HKEY_LOCAL_MACHINE/SECURITY && PS1='# ' || PS1='$ '

Relies on the fact that Cygwin (unlike most non-Cygwin programs) enables 
SeBackupPrivilege if available.

See also:


Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list