public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* /usr/bin/sg in Cygwin?
@ 2024-02-23 21:25 Dan Shelton
  2024-04-19 23:47 ` Dan Shelton
  0 siblings, 1 reply; 10+ messages in thread
From: Dan Shelton @ 2024-02-23 21:25 UTC (permalink / raw)
  To: cygwin

Hello!

Is there a package which provides /usr/bin/sg (execute shell commands
in a different group)?

Dan
-- 
Dan Shelton - Cluster Specialist Win/Lin/Bsd

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: /usr/bin/sg in Cygwin?
  2024-02-23 21:25 /usr/bin/sg in Cygwin? Dan Shelton
@ 2024-04-19 23:47 ` Dan Shelton
  2024-04-20  5:38   ` Brian Inglis
  0 siblings, 1 reply; 10+ messages in thread
From: Dan Shelton @ 2024-04-19 23:47 UTC (permalink / raw)
  To: cygwin

On Fri, 23 Feb 2024 at 22:25, Dan Shelton <dan.f.shelton@gmail.com> wrote:
>
> Hello!
>
> Is there a package which provides /usr/bin/sg (execute shell commands
> in a different group)?

?

Dan
-- 
Dan Shelton - Cluster Specialist Win/Lin/Bsd

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: /usr/bin/sg in Cygwin?
  2024-04-19 23:47 ` Dan Shelton
@ 2024-04-20  5:38   ` Brian Inglis
  2024-04-21 23:20     ` Dan Shelton
  2024-04-22  5:35     ` Cedric Blancher
  0 siblings, 2 replies; 10+ messages in thread
From: Brian Inglis @ 2024-04-20  5:38 UTC (permalink / raw)
  To: cygwin

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

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                 -- Antoine de Saint-Exupéry

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: /usr/bin/sg in Cygwin?
  2024-04-20  5:38   ` Brian Inglis
@ 2024-04-21 23:20     ` Dan Shelton
  2024-04-22  1:35       ` Eliot Moss
  2024-04-22  5:55       ` Cedric Blancher
  2024-04-22  5:35     ` Cedric Blancher
  1 sibling, 2 replies; 10+ messages in thread
From: Dan Shelton @ 2024-04-21 23:20 UTC (permalink / raw)
  To: cygwin

On Sat, 20 Apr 2024 at 07:39, Brian Inglis via Cygwin <cygwin@cygwin.com> 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.

Dan
-- 
Dan Shelton - Cluster Specialist Win/Lin/Bsd

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: /usr/bin/sg in Cygwin?
  2024-04-21 23:20     ` Dan Shelton
@ 2024-04-22  1:35       ` Eliot Moss
  2024-04-22  8:46         ` Corinna Vinschen
  2024-04-22  5:55       ` Cedric Blancher
  1 sibling, 1 reply; 10+ messages in thread
From: Eliot Moss @ 2024-04-22  1:35 UTC (permalink / raw)
  To: Dan Shelton, cygwin

On 4/21/2024 7:20 PM, Dan Shelton via Cygwin wrote:
> On Sat, 20 Apr 2024 at 07:39, Brian Inglis via Cygwin <cygwin@cygwin.com> 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.

??

The man pages has:

  newgrp [-] [group] [command [args...]]

which implies to me that you can give a command.

Did that not work for you?  EM

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: /usr/bin/sg in Cygwin?
  2024-04-20  5:38   ` Brian Inglis
  2024-04-21 23:20     ` Dan Shelton
@ 2024-04-22  5:35     ` Cedric Blancher
  2024-04-22 17:40       ` Brian Inglis
  1 sibling, 1 reply; 10+ messages in thread
From: Cedric Blancher @ 2024-04-22  5:35 UTC (permalink / raw)
  To: cygwin

Good morning!

On Sat, 20 Apr 2024 at 07:39, Brian Inglis via Cygwin <cygwin@cygwin.com> 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.

Debian /usr/bin/sg (setgid analog to /usr/bin/su) comes from the
package "login" (https://packages.debian.org/bookworm/login), same
package as /usr/bin/newgrp. So maybe it just needs to be packaged by
whoever owns the Cygwin package for /usr/bin/newgrp?

Ced
-- 
Cedric Blancher <cedric.blancher@gmail.com>
[https://plus.google.com/u/0/+CedricBlancher/]
Institute Pasteur

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: /usr/bin/sg in Cygwin?
  2024-04-21 23:20     ` Dan Shelton
  2024-04-22  1:35       ` Eliot Moss
@ 2024-04-22  5:55       ` Cedric Blancher
  2024-04-22  8:54         ` Corinna Vinschen
  1 sibling, 1 reply; 10+ messages in thread
From: Cedric Blancher @ 2024-04-22  5:55 UTC (permalink / raw)
  To: cygwin

On Mon, 22 Apr 2024 at 01:20, Dan Shelton via Cygwin <cygwin@cygwin.com> wrote:
>
> On Sat, 20 Apr 2024 at 07:39, Brian Inglis via Cygwin <cygwin@cygwin.com> 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

Ced
-- 
Cedric Blancher <cedric.blancher@gmail.com>
[https://plus.google.com/u/0/+CedricBlancher/]
Institute Pasteur

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: /usr/bin/sg in Cygwin?
  2024-04-22  1:35       ` Eliot Moss
@ 2024-04-22  8:46         ` Corinna Vinschen
  0 siblings, 0 replies; 10+ messages in thread
From: Corinna Vinschen @ 2024-04-22  8:46 UTC (permalink / raw)
  To: cygwin

On Apr 21 21:35, Eliot Moss via Cygwin wrote:
> On 4/21/2024 7:20 PM, Dan Shelton via Cygwin wrote:
> > On Sat, 20 Apr 2024 at 07:39, Brian Inglis via Cygwin <cygwin@cygwin.com> 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.
> 
> ??
> 
> The man pages has:
> 
>  newgrp [-] [group] [command [args...]]
> 
> which implies to me that you can give a command.
> 
> Did that not work for you?  EM

WJFFM:

  $ id
  uid=1049577(corinna) gid=1049701(vinschen) groups=1049701(vinschen),545(Users),14(REMOTE INTERACTIVE LOGON),4(INTERACTIVE),11(Authenticated Users),15(This Organization),4095(CurrentSession),66048(LOCAL),1049089(Domain Users),70145(Authentication authority asserted identity),1049148(Denied RODC Password Replication Group),401408(Medium Mandatory Level)
  $ newgrp Users id -g
  545


Corinna

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: /usr/bin/sg in Cygwin?
  2024-04-22  5:55       ` Cedric Blancher
@ 2024-04-22  8:54         ` Corinna Vinschen
  0 siblings, 0 replies; 10+ messages in thread
From: Corinna Vinschen @ 2024-04-22  8:54 UTC (permalink / raw)
  To: cygwin

On Apr 22 07:55, Cedric Blancher via Cygwin wrote:
> On Mon, 22 Apr 2024 at 01:20, Dan Shelton via Cygwin <cygwin@cygwin.com> wrote:
> >
> > On Sat, 20 Apr 2024 at 07:39, Brian Inglis via Cygwin <cygwin@cygwin.com> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: /usr/bin/sg in Cygwin?
  2024-04-22  5:35     ` Cedric Blancher
@ 2024-04-22 17:40       ` Brian Inglis
  0 siblings, 0 replies; 10+ messages in thread
From: Brian Inglis @ 2024-04-22 17:40 UTC (permalink / raw)
  To: cygwin

On 2024-04-21 23:35, Cedric Blancher via Cygwin wrote:
> Good morning!
> 
> On Sat, 20 Apr 2024 at 07:39, Brian Inglis via Cygwin <cygwin@cygwin.com> 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.
> 
> Debian /usr/bin/sg (setgid analog to /usr/bin/su) comes from the
> package "login" (https://packages.debian.org/bookworm/login), same
> package as /usr/bin/newgrp. So maybe it just needs to be packaged by
> whoever owns the Cygwin package for /usr/bin/newgrp?

The Linux package is all about PAM hooks and other Linux stuff.

As with BSD, login authentication is delegated to the underlying OS, in this 
case MS Windows, so any such utilities have to be rewritten, using the 
underlying emulation or OS access layers, or additions to them.
-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                 -- Antoine de Saint-Exupéry


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-04-22 17:44 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-23 21:25 /usr/bin/sg in Cygwin? Dan Shelton
2024-04-19 23:47 ` Dan Shelton
2024-04-20  5:38   ` Brian Inglis
2024-04-21 23:20     ` Dan Shelton
2024-04-22  1:35       ` Eliot Moss
2024-04-22  8:46         ` Corinna Vinschen
2024-04-22  5:55       ` Cedric Blancher
2024-04-22  8:54         ` Corinna Vinschen
2024-04-22  5:35     ` Cedric Blancher
2024-04-22 17:40       ` Brian Inglis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).