X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DCAAA3849AEE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1713776127; bh=n/tpKROaxd5IBNDaBm/CjqRV921fs+GVvmVWsvXoG4k=; 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=sZudLPjj2Fda9/z46xBcMmhdGAI3CIw0MK+irI/pDxhedce0gTen4A71R0m/Qtj0n BuKsaVLKbecbXBUovZSQFPHZOhWuwxW6prWyuLJ0Ww/r61RzcrxzHlqKIDKYMxbHAX 2ASrKyfQuyBeJLX5ZNpnP02o+7pDYpmT32GLUViA= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8358B3858D38 Date: Mon, 22 Apr 2024 10:54:33 +0200 To: cygwin AT cygwin DOT com Subject: Re: /usr/bin/sg in Cygwin? 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 Apr 22 07:55, Cedric Blancher via Cygwin wrote: > On Mon, 22 Apr 2024 at 01:20, Dan Shelton via Cygwin wrote: > > > > On Sat, 20 Apr 2024 at 07:39, Brian Inglis via Cygwin wrote: > > > > > > On 2024-04-19 17:47, Dan Shelton via Cygwin wrote: > > > > On Fri, 23 Feb 2024 at 22:25, Dan Shelton wrote: > > > >> Is there a package which provides /usr/bin/sg (execute shell commands > > > >> in a different group)? > > > > > > The POSIX standard command is newgrp - install cygwin-doc to see Cygwin (and > > > newlib libc) man pages (and info, html, PDF docs), man-pages-posix to see POSIX > > > man pages, and man-pages-linux if you want to see recent Linux release man pages. > > > > > > To see possibly relevant commands, run: > > > > > > $ apropos -s 1,1p group > > > chgrp (1) - change group ownership > > > chgrp (1p) - change the file group ownership > > > chown (1) - change file owner and group > > > g3topbm (1) - convert a Group 3 fax file into a PBM image > > > groups (1) - print the groups a user is in > > > id (1) - print real and effective user and group IDs > > > make (1) - GNU Make utility to maintain groups of programs > > > make (1p) - maintain, update, and regenerate groups of programs > > > mkgroup (1) - Write /etc/group-like output to stdout > > > newgrp (1) - change primary group for a command > > > newgrp (1p) - change to a new group > > > pbmtog3 (1) - convert a PBM image into a Group 3 MH fax file > > > > newgrp(1) is USELESS. It only opens an interactive shell, but does not > > allow the user to execute a non-interactive script with the requested > > group like bash -c does. > > Linux /usr/bin/sg source is in > https://github.com/shadow-maint/shadow/blob/master/src/newgrp.c > So this is just a packaging issue that whoever does the Cygwin newgrp > package has to package /usr/bin/sg too newgrp(1) is a Cygwin util from the base package: $ cygcheck -f /usr/bin/newgrp cygwin-3.6.0-0.109.ga0a25849f9dd Reason being that the functionality under Windows is pretty limited compared to "real" POSIX systems... https://cygwin.com/cygwin-ug-net/newgrp.html ...and fetching the default environment of the user (to implement the dash option '-') is pretty different from any other known POSIX system, having to use Windows functions: https://cygwin.com/cgit/newlib-cygwin/tree/winsup/utils/newgrp.c If anybody thinks he or she can provide a useful shadow-utils package, feel free. But it might not be worth the effort, probably. 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