I am not sure of the exact method NIS employs but I am fairly sure that
there is a way, using NIS. I can however provide some clues if you can
read bash scripts. Check out these files: /usr/lib/yp/ypinit and the
file /var/yp/Makefile I also know for a fact that OpenLDAP can be used
instead of NIS and that there are directions on how to create an access
control list which will can prevent or allow users to access specific
machines.