delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/10/24/13:05:43

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:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
q=dns; s=default; b=AlgzxS+/DERvzbbjlEmxhm4Mu0Dexrfv7Vn4M3Q9Gcs
hBoTbJ5fAVDQQhhLocu8FqWVNZZyKqHPzZeGqMH+GWIL2KD7zb/eDDa3b9WL0viy
Xdv2+skTGC/NBEGVw6bPIC/aJPntlRhZzsR3JE6C9yJ926nTKxh8CqkdlzuIyZFk
=
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:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
s=default; bh=9iZ9LUm+cqAU1y40GAd4wVZ/CPs=; b=rq5RBfgnd0Zasu8zf
RRtff3QugyxGl1soWDSMKVAKsi7DNYwuDz9a2dvUo2gwpCOcnroO3mpQb2u01YWy
bEs5tluTAivDphRscI7BVVxmHD+QEWe4+QMWmPqhVxQcLhtEFGKEa5se3S6ddfe7
qOOe5kn3Tc+t9yKy1z/S3+XMgU=
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=-1.0 required=5.0 tests=AWL,BAYES_50,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.2
X-HELO: mailout10.t-online.de
Message-ID: <52695345.3060900@t-online.de>
Date: Thu, 24 Oct 2013 19:05:09 +0200
From: Christian Franke <Christian DOT Franke AT t-online DOT de>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0 SeaMonkey/2.19
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Root/Administrator privileges from cygwin terminal
References: <21085 DOT 47545 DOT 572257 DOT 639431 AT consult DOT pretender>
In-Reply-To: <21085.47545.572257.639431@consult.pretender>
X-IsSubscribed: yes

someone at kosowsky dot org wrote:
> 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.)

This should work with any shell:

   case " `id -G` " in *\ 544\ *) true;; *) false;; esac


I use this alternative approach to set a root prompt in /etc/profile:

   [ -r /proc/registry/HKEY_LOCAL_MACHINE/SECURITY ]

Instead of admin group membership this checks for SeBackupPrivilege.
See http://cygwin.com/ml/cygwin/2012-02/msg00806.html

Christian


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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