Maps, Matey!
On the last installment we began to setup the NIS server for Cannelloni Inc, a performance kitcar manufacturing company. Now that we have the domain name defined and a home for the NIS maps we are going to use, how about creating some maps? We will go over that by first working on the NIS server, by creating and exporting the maps, and then reading them in the client.
Server setup
Ok, we need to create the NIS maps, but what are those maps anyway? Well, maps are the files NIS uses to keep the information it needs and passes around. Think of them as plain text databases where each entry is a pair (as in first column is defined by the remaining columns). I guess the best way to explain them is to show how they compare to some of the files used by Linux/Unix:
Maps | Equivalent unix file | Comments |
hosts.byname, hosts.byaddr | /etc/hosts | Maps IP addresses to host names |
passwd.byname, passwd.byuid | /etc/passwd | Maps UIDs to usernames (and passwords) |
group.byname, group.bygid | /etc/group | Maps Group IDs to group names |
So, our /etc/src/auto.home would look something like this:
bob -nosuid,intr obelix.cannelloni.com:/export/home/bob thetick -nosuid,intr obelix.cannelloni.com:/export/home/thetick heathcliff -nosuid,intr obelix.cannelloni.com:/export/home/heathcliff mccoy -nosuid,intr obelix.cannelloni.com:/export/home/mccoy
and so on.
The netgroup map, which we chose (when we edited the /var/yp/Makefile, remember?) to be stored in /var/yp/, is like the groups file but can be used to group not only users but also any combination of users, domains, and hosts. We have two printers, falbala and bonemine, so we create a group for them which will be called printers. So far, our /var/yp/netgroup file looks like this:
openwheel (assurancetourix,,) (alambix,,) (caiousbonus,,) (petisuix,,) printers (falbala,,) (bonemine,,)
Remember that once you ad a Linux box as a NIS client you should run /usr/sbin/gdm-restart so the login window knows of the changes and maps. For some reason, ssh and the text-based login screen have no problems being updated, but gdm does. Perhaps it is buffering the user data.
For Linux, create an /etc/exports file that looks like this:
/home/sunpci/linux 192.168.0.11(rw,no_root_squash)
For Solaris, set up your /etc/dfs/dfstab this way:
share -F nfs -o rw=@192.168.0.11/32,root=@192.168.0.11/32 /home/sunpci/linux
Once you have finished with /etc/exportfs, you need to make the changes take place by typing
Linux:
# exportfs -a
Solaris:
# share all