Managing NIS Automount Maps

The following procedure addresses the most common management tasks for NIS automount maps.

Prerequisites

NIS must be configured on your network. See NIS Installation and Configuration for further information.

Procedure

  1. Edit the /etc/auto.master file. The >automount daemon, by default, reads the NIS /etc/auto.master map to find which directories to watch for mounts. The auto.master map has the following format:
    DirectoryPath     AutomountMapName

    The AutomountMapName field specifies a file containing the automount map for the directory specified by the DirectoryPath field. For example, the contents of the /etc/auto.master file on the NIS server might be as follows:

    /home/home     /etc/auto.home
    /usr/lpp       /etc/auto.direct

    The above auto.master file entries direct the automount daemon to use the /etc/auto.home automount map for the /home/home directory and the /etc/auto.direct automount map for the /usr/lpp directory.

  2. Create the AutomountMapName files. The AutomountMapName files have the following format:
    Subdirectory   MountOptions   ServerName:ServerDirectory

    The Subdirectory field specifies a subdirectory of the DirectoryPath field directory of the auto.master file. For example, the contents of the /etc/auto.home file on the NIS client might be as follows:

    john            -rw,hard,intr    host1:/home/john
    bill            -rw,hard,intr    host3:/home/bill
    sally           -rw,hard,intr    host5:/home/sally
    fred            -rw,hard,intr    host9:/home/fred
    jane            -rw,hard,intr    host1:/home/jane

    The contents of the /etc/auto.direct file on the NIS client might be as follows:

    X11             -ro,hard,intr    lppserver:/usr/lpp/X11
    bsmEn_US        -ro,hard,intr    lppserver:/usr/lpp/bsmEn_US
    gnuemacs        -ro,hard,intr    lppserver:/usr/lpp/gnuemacs
    info            -ro,hard,intr    lppserver:/usr/lpp/info
  3. Update the /var/yp/Makefile file, as follows:
    1. Add auto.master to the all: listing.
    2. Add an entry for $(DIR)/auto.master: at the appropriate point in the file.
    3. Add the following stanza to the Makefile file:
      auto.master.time: $(DIR)/auto.master
              -@if [ -f $(DIR)/auto.master ] ; then \
                      $(MAKEDBM) $(DIR)/auto.master $(YPDBDIR)/$(DOM)/auto.master; \
                      touch auto.master.time ; \
                      echo "updated auto.master" ; \
                      if [ ! $(NOPUSH) ] ; then \
                               $(YPPUSH) auto.master ; \
                               echo "pushed auto.master" ; \
                      else \
                               : ; \
                      fi \
              else \
                      echo "couldn't find $(DIR)/auto.master" ; \
              fi
    4. Add an entry for auto.master: auto.master.time at the appropriate point in the Makefile file.

    In general, the same format that is used for the netmasks entry in the Makefile file can be used for the auto.master entry.

  4. Build the auto.master map with the following command:
    make auto.master

    If errors are generated, check for improper configuration of NIS, errors in the Makefile file, or errors in the syntax of the /etc/auto.master file.

  5. Start the automount daemon with the following command:
    /usr/sbin/automount

    This starts the automount daemon, which reads the auto.master NIS map.

    In the preceding examples, when these procedures are completed, a user on the client can issue the cd /home/home/bill command and have the /home/bill directory mounted from the host3 system onto the /home/home/bill directory.