NIS Client Networking  «Prev 

Using NIS maps

For the information being distributed by the NIS server to be used by the NIS client, you must configure the /etc/nsswitch.conf file to include nis in the search path for each file you want to use. The following is a listing from the /etc/nsswitch.conf file showing valid values that can be in the search paths for accessing different configuration files.

# Legal entries are:
# nisplus or nis+ Use NIS+ (NIS version 3)
# nis or yp Use NIS (NIS version 2), also called YP
# dns Use DNS (Domain Name Service)
# files Use the local files
# db Use the local database (.db) files
# compat Use NIS on compat mode
# hesiod Use Hesiod for user lookups
# [NOTFOUND=return] Stop searching if not found so far

For our purposes, we want to add nis into the paths for the files we want to distribute from our NIS server to the NIS client. In most cases, the local files are checked first (files), followed by nisplus. The following are examples of how some entries appear:
passwd: files nisplus
shadow: files nisplus
group: files nisplus
hosts: files nisplus dns

For each of these entries, the original files are checked first (/etc/passwd, /etc/shadow, and so on). Then any nisplus server is checked. For host names, the DNS server is checked last. For our purposes, we can change nisplus to nis to access the maps being shared from the NIS server. The lines would then appear as follows:
passwd: files nis
shadow: files nis
group: files nis
hosts: files nis dns

As soon as the /etc/nsswitch file is changed, the data from the NIS maps are accessible. No need to restart the NIS service. You can now go through and change any of the files listed in the /etc/nsswitch file so that it is configured to let our system access the NIS maps being shared.
Red Hat Reference

Typical /etc/nsswitch.conf line for NIS

nsswitch.conf line for NIS

  1. Linux refers to this line when seeking information about hosts. Other information maps include password services and protocols
  2. On this particular network, Linux first checks the NIS server for hostname information
  3. If the NIS system fails to find the requested information, the local files are checked. In this case, Linux checks
  4. After NIS and local files have failed to return the sought for information, Linux checks the DNS system. If DNS fails, the user application that requested the information receives an error message.