Mapping User ID and Group ID


If someone is logged in to a client as root, he or she is only granted world permission on the server.   You can undo this with the no_root_squash setting, but do so with caution.   The no_root_squash setting opens more holes for intruders to exploit, which is never a good idea.


  Use all_squash to map every user of a client system to the user nobody, for example, the following entry exports the /pub directory to every client:


   /pub   (ro, all_squash)


  It grants read-only access to the directory to every client, and limits every user of those clients to the world permissions granted to nobody.   Therefore, the only files the users can read are those that have world read permissions.


  It is also possible to map, every user from a client to a specific user ID or group ID.   The anonuid and anongid options provides this capabilities.   These options are most useful when the client has only one user, and the client does not assign that user a UID or GID.


The perfect example of this is a MS windows PC running NFS.   PCs generally have only one user, and they don't use UIDs or GIDs.   To map the user of a PC to a valid user ID and group ID, enter a line such as this in the /etc/exports file:


  /home/kristin  robin(all_squash, anonuid=1001, anongid=1001)


  Note:


/home/kristin 

   the entry grants read/write access to the direcotry here-in

robin 

   here, the hostname of Kristin's PC is robin

all_squash 

   this option maps every request from that client to a specified user ID; but this time it's not nobody

anonuid=1001 

   should be the user id (UID) assigned to kristin in the /etc/passwd file of the server

anongid=1001 

   should be the group id(GID) assigned to kristin in the /etc/passwd file of the server

  

Of course, for this to work correctly, 1001:100: UID and GID moust exist in the /etc/passwd file of the server and kristin as a user must exist as well.....