Root/Administrator privileges from cygwin terminal

Christian Franke Christian.Franke@t-online.de
Thu Oct 24 17:11:00 GMT 2013


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



More information about the Cygwin mailing list