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: [PATCH] base-files-4.2-1: Change prompt if running with admin rights

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
Especially given that in future there might be no /etc/group to begin

But even without /etc/group, the administrator's group will have the
gid 544.  I think such a test should be sufficient?


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="# "
+case " $(/usr/bin/id -G) " in
+  *\ 544\ *) PS1a="# " ;;

Works for me with bash, dash, mksh, posh, and zsh.


Problem reports:
Unsubscribe info:

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