www.delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
:list-unsubscribe:list-subscribe:list-archive:list-post | |
:list-help:sender:date:from:to:subject:message-id:reply-to | |
:references:mime-version:content-type:in-reply-to; q=dns; s= | |
default; b=AnBnoxuPftsinIvZXURsKQ+b8GADsufJZanbH6wi4X/KV0Uid1uUU | |
uCX2J70HezcxKOeN7MbxMUZhLIPrAk4sCyDYioVx5mLUOXHKUFjm4VkHrHK7rfw/ | |
ISWUa7wTcZO60EeXG81KcNpn5ik2V0OjdRfXdwBZWHh4tfvYr2SNi0= | |
DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
:list-unsubscribe:list-subscribe:list-archive:list-post | |
:list-help:sender:date:from:to:subject:message-id:reply-to | |
:references:mime-version:content-type:in-reply-to; s=default; | |
bh=QdIDJoCyZht/x9d9dbTtRlev6iY=; b=ZI8BirACjKuLdW5CBrr61U9pRItM | |
Krrj3vZwRe2y8npFyNQDN04xpkbEtI8o7g2IMB4Ixb+rfCbVhRyOMGTf2pOjddyd | |
2ccCQpfK/joZ33j+B7AUPeNPbch9HzNs6MUGh5T5B4vFTkWA0sB6IEgVD4N6iy8z | |
xxLW0kWG8DUz7Z8= | |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
Authentication-Results: | sourceware.org; auth=none |
X-Virus-Found: | No |
X-Spam-SWARE-Status: | No, score=-5.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 |
X-HELO: | calimero.vinschen.de |
Date: | Thu, 5 Feb 2015 11:03:49 +0100 |
From: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> |
To: | cygwin AT cygwin DOT com |
Subject: | Re: how to determine if a shell is running as Administrator? |
Message-ID: | <20150205100349.GS2635@calimero.vinschen.de> |
Reply-To: | cygwin AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
References: | <slc6da9aq8g9e7h0aegafhfa86eahfd53p AT 4ax DOT com> |
MIME-Version: | 1.0 |
In-Reply-To: | <slc6da9aq8g9e7h0aegafhfa86eahfd53p@4ax.com> |
User-Agent: | Mutt/1.5.23 (2014-03-12) |
--ai3I8gwHc37+ASRI Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Feb 5 04:43, Andrew Schulman wrote: > What's a reliable and efficient way to determine programmatically if the = shell > that's running has elevated privileges? >=20 > Or if you prefer, how can I tell if the shell was started with "Run as > administrator"? id -G | grep -qE '\<544\>' && echo admin || echo luser > 2. Parse the output of groups or id -G. I can't find any reliable way to= do > this. For example on my host, when I start a shell with "Run as administ= rator", > the new group I get isn't 544 (Administrators). It's 114 (Local account = and > member of Administrators group). Is that at all portable or reliable? Huh? There is no such group in Windows. Where does it come from? This should always work even with old /etc/group files: id -G | grep -qE '\<544\>|\<0\>' && echo admin || echo luser Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --ai3I8gwHc37+ASRI Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJU00AFAAoJEPU2Bp2uRE+gkPUQAIfnGFGJq/58DBhyBYz8iOf2 lueYvyEyu9c8TdjaOHF6PdQjDajk/tEQcKCH+m3PCoQy2Tq0sYSLKlbdxqLcPA84 ZZMSKje78wRxQ+wWlZ7k+vKkC7GpSHFGOzbYcDW5E2eaXO7azVdnUhNE+Dmlu/Yy Rvug5gHNnmNb1dew0VbY4bxKNOxHTuyjVzvSahRhbVM2ENvBkvskIm0qgGPtjvbi pi3P1q/snkudXBwBigyL59IW5rabi+x0solk+CiXLhM7+gTo4hss5NTM+qQrpSvc Tc1TjCIwXdBczdOQbKUXdE+gKD26tUQnoyTW9DlQ7MYaWEsxYchJNFvTb5U3fNkm 2Xk0sD7Pf+ZUCOjfhG9zbnPS25ce28LsTi0zDHD1YQ2+uZs5Naqzrs3K/w1tZ4iv Jj/M322+/uMfRSnVCGileWIcRQ+TRC6FnRgASoB1823qWX0ZPulFUOnFT0D2rILO NAofY6HAd+JwA0yEUxHBXdQ630OxTYJKyBNVisXq7rueXnuBJz0X9TW3SAvxFuY5 KZj+QzySktVk0/g3UpMzvbiB2JdLTQhGuPcWEtLJcQecxdpkspbooFaCIt1xrjqx FKjI8JIbGyZB+FXLQpULGZ5h5FEbP3ARF5IqCo2HaaDHc/cdHysb3AueRvpE9UC8 W0+0ypx8fq9t2s8olOcd =HZEx -----END PGP SIGNATURE----- --ai3I8gwHc37+ASRI--
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |