how to determine if a shell is running as Administrator?

Corinna Vinschen corinna-cygwin@cygwin.com
Thu Feb 5 14:53:00 GMT 2015


On Feb  5 15:28, Achim Gratz wrote:
> J. David Boyd writes:
> > This doesn't seem to tell me if my shell has been started with 'Run As
> > Administrator', it just tells me if my user is contained in the Administrator
> > group.
> 
> No, you're not in that group unless you have actual administrator
> privileges.
> 
> > I can start a cygwin shell, and start a cygwin shell with run as admin, and I
> > get the same results from the above command.
> 
> Then you have UAC switched off or the place you're starting the cygwin
> shell from already is elevated.

Right.  Group 544 is not in a user token of a non-elevated process(*).


Corinna


(*) More exactly, it is in the token, but with the "Deny only" attribute
    and missing the "Enabled" attribute.  Therefore it will not show up
    as part of the token's group list in Cygwin, because Cygwin skips
    all non-enabled groups.

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20150205/bb499e1d/attachment.sig>


More information about the Cygwin mailing list