This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Root/Administrator privileges from cygwin terminal
- From: Christian Franke <Christian dot Franke at t-online dot de>
- To: cygwin at cygwin dot com
- Date: Thu, 24 Oct 2013 19:05:09 +0200
- Subject: Re: Root/Administrator privileges from cygwin terminal
- Authentication-results: sourceware.org; auth=none
- References: <21085 dot 47545 dot 572257 dot 639431 at consult dot pretender>
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