[comp.protocols.tcp-ip.ibmpc] Wanted: newgrp

root@lingua.cltr.uq.OZ.AU (Hulk Hogan) (02/01/91)

Hi,

Unix hosts allow user's to be members of more than one group at one time.
The "primary group" is the one in the /etc/passwd file, unless a newgrp(1)
is executed.  PC-NFS identifies a user by keeping a uid and a single gid.
What I'm after is a DOS command which would allow a PC-NFS user to change
their gid to a valid group on the NFS host.  Anyone have one?

Situation:  PC-NFS'd user accessing NFS files from a Sun host in the DOS
environment. He can't access some data from his PC because PC-NFS only keeps
his primary gid, and it one of his secondary gids which is the gid of the
data and which allows him access when he is logged on the NFS host.
Making his primary gid the same as the data is not a good solution.

Anyone have a newgrp(1) command?  The code doesn't sound so hard.
The group is in argv[1].  It does an RPC to the PCNFSD to verify that the
user is in the group, and if so, resets the gid variable to the gid.
I guess it would require some mods to rpc.pcnfsd to support a getgrnam(2)
call, and some clever way of finding where the PC-NFS stores the uid and gid.

/\ndy
-- 
Andrew M. Jones,  Systems Programmer, 	Internet: andy@lingua.cltr.uq.oz.au
Centre for Lang. Teaching & Research, 	Phone (Australia):  (07) 365 6915
University of Queensland,  St. Lucia, 	Phone (World):    +61  7 365 6915
Brisbane,  Qld. AUSTRALIA  4072 	Fax: 		  +61  7 365 7077

"No matter what hits the fan, it's never distributed evenly....."

geoff@hinode.East.Sun.COM (Geoff Arnold @ Sun BOS - R.H. coast near the top) (02/01/91)

Quoth root@lingua.cltr.uq.OZ.AU (Hulk Hogan) (in <1991Feb1.011142.10895@lingua.cltr.uq.OZ.AU>):
#Hi,
#
#Unix hosts allow user's to be members of more than one group at one time.
#The "primary group" is the one in the /etc/passwd file, unless a newgrp(1)
#is executed.  PC-NFS identifies a user by keeping a uid and a single gid.
#What I'm after is a DOS command which would allow a PC-NFS user to change
#their gid to a valid group on the NFS host.  Anyone have one?
#
#Situation:  PC-NFS'd user accessing NFS files from a Sun host in the DOS
#environment. He can't access some data from his PC because PC-NFS only keeps
#his primary gid, and it one of his secondary gids which is the gid of the
#data and which allows him access when he is logged on the NFS host.
#Making his primary gid the same as the data is not a good solution.

I presume that you're not running NIS (a.k.a. YP), since if you were,
and the "group.byname" map was set up correctly, the user would belong
to all the appropriate groups. You'd still need a "newgrp" command to
change the primary group to affect the group for newly-created files.

You can check what groups you're in by executing NET NAME. Here's a sample
output; if you are a member of any secondary groups, this will be
displayed after the "You are logged in..." line. (And yes, eagle-eyed readers
will notice some changes from 3.0.1 in this display. Patience....)

   The name of this system is dreamboat, and its IP address is 129.148.5.40.
   The subnet mask is 255.255.255.0 [0xffffff00].
   It is in network information service domain Ecd.East.Sun.COM, served by vindaloo (129.148.5.1).
   The authentication server is hinode (129.148.5.18).
   Non-local routing via gateway vindaloo (129.148.5.1).
   Specific routing entries:
   ...to host shark (129.148.8.2) via shark-bb (129.148.5.3).
   You are logged in as nfstest, with UID 1079 and GID 9.
   You are also a member of groups :
           760 750 740 790 780 770 720 710 
   It is Fri Feb 01 08:44:43 1991, EST

(Don't bother trying to reach any of these hosts: we're firewalled :-)

And while we're talking about setting the group on file creation,
let me point out that the next release of PC-NFS will honour the
set-group-id bit on directories, as described in "man creat":

     The file's group ID is set to either:

     +  the effective group ID of the process [i.e. the user], if [...]
        the set-gid bit of the  parent  directory is clear, or

     +  the group ID of  the  directory  in  which  the  file  is
        created.

This was bugid 1029951.

-- Geoff Arnold, PC-NFS architect, Sun Microsystems. (geoff@East.Sun.COM)   --
------------------------------------------------------------------------------
--                   No cute comments. War isn't cute.                      --
------------------------------------------------------------------------------