Creating your own NIS maps

  • By modifying /var/yp/Makefile, you can create your own NIS maps.
  • For example, we have telephone numbers in file /etc/telephones
    
    Jen   5-3906
    Mike  5-1234
    Dave  5-2345
    

  • To generate a NIS map for telephones, modify /var/yp/Makefile on the NIS server as follows:
    after NETMASKS = $(YPSRCDIR)/netmasks, create a new line with
    
    TELEPHONES  = $(YPSRCDIR)/telephones
    
    Add telephones to the list of NIS maps:
    
    ALL =   passwd group netgrp telephones
    
    In end of the file, create a new entry
    
    telephones: $(TELEPHONES) $(YPDIR)/Makefile
            @echo "Updating $@..."
            @$(AWK) '{ print $$1"\t"$$0 }' $(TELEPHONES) | $(DBLOAD) \
            -r -i $(TELEPHONES) -o $(YPMAPDIR)/$@ - $@
            -@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@
    
    NOTE: each new line after telephones: starts with < Tab > .

  • Re-build the NIS maps:
    
    cd /var/yp; make
    

  • Check if you can get the phone numbers on the client through NIS:
    
    ypcat telephones
    


    Previous Pageprevious First Pagetop Next Pagenext