X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 914C7385840D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1710176239; bh=Mj5RvMrWjGEtBcdqx5epkIRp1bW+ZaaA73BVWk/kdOE=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=opi3tSttnuuS0BaIi4f46s4QG8+FaP8vfnaQl+WwHMrzWlaTLWqwADTRIlSShmnxV USlpfc6IJ/Gb1ijC+r74mJIuEI5zqCg/FfeSN4vaq1uqz0DbFCZDoX1btluWqxmAug s7Ob0l68PT8s60SfMYjMge/wXk/tuyC83r+3pflc= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 322BA3858D20 Date: Mon, 11 Mar 2024 17:56:59 +0100 To: cygwin AT cygwin DOT com Subject: Re: Switching groups with newgrp - how to get the new group with |GetTokenInformation()| ? Message-ID: Mail-Followup-To: cygwin AT cygwin DOT com References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Corinna Vinschen via Cygwin Reply-To: cygwin AT cygwin DOT com Cc: Corinna Vinschen Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" On Mar 11 02:28, Dan Shelton via Cygwin wrote: > On Wed, 6 Mar 2024 at 14:01, Corinna Vinschen via Cygwin > wrote: > > On Mar 5 23:38, Dan Shelton via Cygwin wrote: > > > Always editing /etc/nsswitch.conf > > > forth and back is not a elegant solution, aside from race conditions > > > with other users on a system > > > > So, here we go again. > > > > - What exactly are you trying to accomplish by enumerating the accounts? > > Maybe you won't actually need it for your task at hand. > > We're trying to do several things, including but not limited to: > - Finding which local groups exist. Part of our customer software > expects that certain groups exist. Unfortunately the group names vary > between installations, and sometimes names are prefixed with site > names. Trying to do all permutations with just getent passwd > $iteration means too many combinations (>= 4000000). So just > enumerating all local groups with getent group would be the way to go. Then just change /etc/nsswitch.conf to enumerate "local" as well and be done with it. You can even go so far as to use the Windows enumerator, i.e., $ net localgroup and than script it to use its output as input to getent group for only the groups you really need info for. Corinna -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple