delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/10/24/08:47:46

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=hvPkQ3mT2rSiN+k9M4T9VOHm3NF7VqTDMnU8NNr8XyFIJT+bpexf+
CBPJPaSIMbzvRghVoVZ90BUezg+hV7NStJQmAnJTn48LD1OSwy0qkaue6aWFuzJX
XcfsH5yAFDGgJ3MEeZYMkEIppkpQhnQTw5f6Mf86Xv+MuHlFFyXyb4=
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=M7d8aMe2mbqpQr1PnSSdTzdDMMM=; b=nguxcA8dzSDTjZcguCm5rvf0aZNE
+JhuA7tlLK7569/b2sCEcoK2nYQJiQ455eCJErFPERWQMYgDTGmQ5Zk2hLVxySs5
69YgKTTVK2F6as3eignwfjcg1am3DEzeTw+gUvYCLgA6ly5AWRgelfMW3Q9yFGFL
XNgnxnL9ASc3yYM=
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=-0.5 required=5.0 tests=AWL,BAYES_20 autolearn=ham version=3.3.2
X-HELO: calimero.vinschen.de
Date: Thu, 24 Oct 2013 14:47:31 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Root/Administrator privileges from cygwin terminal
Message-ID: <20131024124731.GB7575@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <21085 DOT 47545 DOT 572257 DOT 639431 AT consult DOT pretender> <CAFO6C=w=JYbEdGpaqM_f9GE=_=542q8a+VVCJVbYkEvf=Z=gMA AT mail DOT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <CAFO6C=w=JYbEdGpaqM_f9GE=_=542q8a+VVCJVbYkEvf=Z=gMA@mail.gmail.com>
User-Agent: Mutt/1.5.21 (2010-09-15)

--0F1p//8PRICkK4MW
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Oct 24 12:22, Anthony Geoghegan wrote:
> >    The only solution I have now is to open a new bash window as adminis=
trator.
> >    So is there a way to elevate (or change) privileges from with a bash=
 shell?
>=20
> A while ago, I researched a Cygwin equivalent for sudo but that's what
> I ended up doing, myself.
>=20
> > 2. Is there any better way to determine that one has Administrator
> >    privileges than to run something like:
> >                 id -G | grep -Eq '<\544\>'
> >    Or:
> >                 [[ `id -G` =3D~$(echo "\<544\>") ]]
> >
> >         (note the 'echo' is used to get around incompatibilities in
> >         various versions of bash on how word separators are recognize.)
>=20
> I use something similar:  [[ $(groups) =3D=3D *Administrators* ]]
> It's more readable and it works on pretty much every version of Bash.

There's a disadvantage to this approach.  The name of the Administrators
group is localized, for instance "Administratoren" in German.  The RID
544 is universal, though.


Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--0F1p//8PRICkK4MW
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)

iQIcBAEBAgAGBQJSaRbjAAoJEPU2Bp2uRE+gNWgP/RMFggOWROflGmiBMtABsJ33
fwR6sz+QCQDKYXm/43UPU75g0px2jynVjbYmBW7IjBi5lzuZlrEZdalpC0Vea0ez
lzJEdYIleywuUB/8WS23/7sKhtl323iLiat2SwakVzw8MUo7pHK9y65l19OniYTv
9ZI4cTDR+dB0l8vm1IvV4On8JBJxg0X/byxDb33gVYMILYKLgKWVJasLGUJhFITA
VjhV3X6gXV5Hg9o98lwIFSD5FtK3oLBfvMKGmkc7y4sZcfiW6CeuF6tlbIBZWBTo
FJnLsHipJ74KQE9cMn+xlIzyIYPbJuYnk3JwM+dai6F0AA1obz/AxZYtgjNtQnp/
WTtv/zxZ8pyyumeHUVFMFs9rtuakCK2yqk15Tw37bL5lyAO8VY/Fkz585gAcB+/p
xrNh4EVbPlMiK1n+uA1t8lnG8WK1A2yuOUnJjOB59Ps8Q9JDlFRyGLMvMaPpaljm
YInnhg9jN3dSpYqGjjqkyNdk38gNTZKgR/kOj/DaWJWG2iBVf+/OwTInpPGX9OjE
uodzxFyY9607RfiZS5uKJaPyfdLvkgCA1xQsbFROaNOrVskXyWOzKeKsVuB8jbvJ
0goa/Qo6vXjlZ2zJWsAUWdCixz0+FxCZaawavK/KNWp58rjyyoMRrLmQDOODQMsE
yUmbuZIsrEopCeu/I6Gz
=eXPh
-----END PGP SIGNATURE-----

--0F1p//8PRICkK4MW--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019