SUMMARY: newgrp question

From: Kevin Colagio (
Date: Fri May 12 2000 - 09:47:53 CDT

Thanks to Jay Lessert who got me a working solution...
Thanks to everyone else who had things to check...

The trick has nothing to do with newgrp, rather, you have to change the group of the
parent directory and then set the group sticky bit for that directory. Any files or
directories created under the parent directory will be set so that the group is that
of the parent...

[1] mkdir users
[2] chgrp bin users
[3] chmod g+s users
[4] ls -l users
drwxr-sr-x 1 kevin bin 512 users
[5] cd users
[6] touch test
[7] ls -l test
-rwxr-xr-x 1 kevin bin 0 test
[8] mkdir dir
[9] ls -ld dir
drwxr-sr-x 1 kevin bin 512 dir

Here is my original post:
> I have a group of users that need to change group and then execute a script or
> set of commands right afterwards whenever they are working on a certain project.
> The newgrp command fires off a new shell so it cannot be placed in the middle
> of a script.
> Does anyone know of another way to change a user's group on the fly that doesn't
> start another shell?

Kevin Colagio
System Administrator, Webmaster, and Perpetual Student.

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:14:08 CDT