This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Root/Administrator privileges from cygwin terminal


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]