Root/Administrator privileges from cygwin terminal
Corinna Vinschen
corinna-cygwin@cygwin.com
Thu Oct 24 14:16:00 GMT 2013
On Oct 24 12:22, Anthony Geoghegan wrote:
> > The only solution I have now is to open a new bash window as administrator.
> > So is there a way to elevate (or change) privileges from with a bash shell?
>
> A while ago, I researched a Cygwin equivalent for sudo but that's what
> I ended up doing, myself.
>
> > 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` =~$(echo "\<544\>") ]]
> >
> > (note the 'echo' is used to get around incompatibilities in
> > various versions of bash on how word separators are recognize.)
>
> I use something similar: [[ $(groups) == *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
--
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: 836 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20131024/9f46d741/attachment.sig>
More information about the Cygwin
mailing list