mullen%nrl-css@sri-unix.UUCP (11/19/83)
From: Preston Mullen <mullen@nrl-css> It took just a few minutes to transform newgrp.c into sg.c, where "sg" behaves like "su", except that it changes group id instead of user id and leaves the environment alone. This makes all sorts of applications of groups possible that are just too cumbersome with only "newgrp" to switch groups. In fact, since it is generally the case that no password is needed, it's easy to use "sg" to do some trivial thing in a shell file without creating a special set-gid command for that purpose. My question is, why does such a program not already appear in V7 or 4.1bsd? Other notes: 1. There is also a bug in newgrp.c (4.1bsd 10/1/80) -- what should be the 2nd argument to execl is omitted. Because the third (now second) argument "-i" begins with "-", the new shell is taken for a login shell, which is ridiculous, as the shell that invoked newgrp need not have been a login shell. 2. The 4.1bsd and V7 manual pages for "su" neglect to state that su also changes to the default group id for the new user id (as determined by the /etc/passwd entry for the user id). P.S. I know 4.2bsd obviates "sg", but not everybody has or will get 4.2bsd. (end of message)