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=ack48xsEj8T0yE8QauAoGeISqWJX74/wQmgSUC6GZfP qegeqnNd2MkMh3CV+5HXHs/NVLsUyIIeFu7tuLgO/si1Afpmk+wof4y3WxeQpkbs 5GwAPLNoGKzD7mkJZY6H2y/mB6x4hEmDpPZFb7UnpyCWjUUmBtmdN0d72z0D3+YM = 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=FqU+wcUIGgf2qwO0rEvAgb+CUQI=; b=bOHCScaW5wd4muf+k WEHU49I9+64Hwwe/UGxF4wUcQT91PxfZfzLKAo6d7ebfy65Yqw9xlo34UiX7sCq6 PhjqbA/xNzGXWdDHiXrNhovckYMUBGGXAnHGx1YF2WyGjKqgkCNKiTrpXVfgznRy FK1SiKGo/cTmQif3ERhn3en9P0= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mailout01.t-online.de Message-ID: <5346BF4C.2090403@t-online.de> Date: Thu, 10 Apr 2014 17:57:00 +0200 From: Christian Franke User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0 SeaMonkey/2.25 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: [PATCH] base-files-4.2-1: Change prompt if running with admin rights References: <53458036 DOT 1010307 AT t-online DOT de> <877g6ys69r DOT fsf AT Rainer DOT invalid> <5345C0C0 DOT 5010908 AT t-online DOT de> <20140410081130 DOT GW2437 AT calimero DOT vinschen DOT de> In-Reply-To: <20140410081130.GW2437@calimero.vinschen.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Corinna Vinschen wrote: > On Apr 9 23:50, Christian Franke wrote: >> I used the registry check in the past because it only uses shell >> builtins and does not rely on specific SID->gid mappings in >> /etc/group. > Especially given that in future there might be no /etc/group to begin > with. > > But even without /etc/group, the administrator's group will have the > gid 544. I think such a test should be sufficient? Yes. Result would only differ for special accounts like "Backup Administrator" (has SeBackup/RestorePrivilege but is not member of local admin group). This change for my patch uses shell builtins for the string matching: # Set PS1a if user has admin rights unset PS1a -if [ -r /proc/registry/HKEY_LOCAL_MACHINE/SECURITY ]; then - PS1a="# " -fi +case " $(/usr/bin/id -G) " in + *\ 544\ *) PS1a="# " ;; +esac Works for me with bash, dash, mksh, posh, and zsh. 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