We've already mentioned that Autofs can be incorporated into a naming service. This allows a whole series of maps to be administered centrally. This can save system administrators a lot of time, since they will not have to have maps copied around the network to the correct machines. There are, however, a number of things we need to be aware of first.
We need to make the usual changes to /etc/nsswitch.conf. The following entry will tell automount to use NIS, followed by the local /etc files:
lithium# grep automount /etc/nsswitch.conf automount: nis files lithium#
NIS supports two existing maps: auto_master and auto_home. This means that we'll need to create entries in the NIS Makefile for any custom maps we have created (auto_man and auto_data). This is easy to do, as we can copy the existing entry for auto_home. We won't explain how this is done, since we've created custom maps before in Chapter 12, “Naming Services and NIS.”
We need to be especially careful if the system is being moved from “local files” to NIS or NIS+, because while a local master map can have multiple direct map entries, an NIS or NIS+ map file can only have one entry.
The reason for this is that the key (the directory entry) for multiple direct maps would be the same “/-” and so would conflict with each other. The way we can get around this problem is to amalgamate all the direct map entries into one large direct map file.
Autofs also allows maps to be included in a variety of ways. Using NIS, we can specify “+mapname” to include the map named mapname. This allows us to further control how the map information is used. For example, if we are using “local files,” and the local master map contains the following entries:
lithium# cat /etc/auto_master +auto_master /net -hosts -nosuid,nobrowse /data auto_data /home auto_home /- auto_man lithium#
then the “+automaster” directive forces the NIS map named auto_master to be read in first, before the remaining entries. This type of configuration is often where the null predefined map is used. To show how this may be used, let's assume that the NIS auto_master added the following entry, but it wasn't required for any production system:
/test_area development_map
We could use the following /etc/master_map definition to remove the entry. Note that the null map should be inserted before the included map:
lithium# cat /etc/auto_master /test_area -null +auto_master /net -hosts -nosuid,nobrowse /data auto_data /home auto_home /- auto_man lithium#