Introduction
This page describes how Alexis Huxley installed and configures a NIS master or slave server.
Procedure
- This procedure uses some environment variables, so set them:
NETMASK=<netmask> # E.g. NETMASK=255.255.255.0 NETWORK=<network-addr> # E.g. NETWORK=192.168.1.0 NIS_DOMAIN=<nis-domain-name> # E.g. NIS_DOMAIN=pasta.net
- To install a NIS master server:
- Install the required packages by running:
apt-get install nis
- Work around bug LP#1558196 / BTS#805167 by running:
systemctl add-wants multi-user.target rpcbind.service
(PCMS does this for NIS clients, but not for NIS servers.)
- Run the following commands:
echo $NIS_DOMAIN > /etc/defaultdomain perl -pi -e "s/^(NISSERVER)=.*/\$1=master/" /etc/default/nis { echo "255.0.0.0 127.0.0.0" echo "$NETMASK $NETWORK" } > /etc/ypserv.securenets
- Add support for the auto.staging automounter map by editing /var/yp/Makefile and at the appropriate places adding the following stanzas:
# Clone AUTO_HOME variable AUTO_STAGING = $(YPSRCDIR)/auto.staging # Add this complete line with the other 'ALL += ...' lines ALL += auto.master auto.home auto.staging # Clone auto.home recipe auto.staging: $(AUTO_STAGING) $(YPDIR)/Makefile @echo "Updating $@..." -@sed -e "/^#/d" -e s/#.*$$// $(AUTO_STAGING) | $(DBLOAD) \ -i $(AUTO_STAGING) -o $(YPMAPDIR)/$@ - $@ -@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@
- Edit /etc/auto.master to contain only:
/home yp:auto.home /staging yp:auto.staging
- Remove unwanted maps and initialise wanted ones by running something like:
rm -f /etc/auto.misc rm -f /etc/auto.net rm -f /etc/auto.smb > /etc/auto.home > /etc/auto.staging
- Populate the following files properly:
- /etc/passwd
- /etc/group
- /etc/auto.home
- /etc/auto.staging
- Compile the maps by running:
systemctl restart nis # make will complain if the service is not running first make -C /var/yp
- Test by running:
ypwhich domainname id alexis ypcat auto.home su - alexis -c pwd
- Install the required packages by running:
- To install a NIS slave server:
- On the master server run:
perl -pi -e "s/^(NOPUSH)=.*/\$1=false/" /var/yp/Makefile echo <name-of-nis-slave-server> | /usr/lib/yp/ypinit -m
- On the slave server, install the required packages by running:
apt-get install nis
- Run the following commands:
echo $NIS_DOMAIN > /etc/defaultdomain perl -pi -e "s/^(NISSERVER)=.*/\$1=slave/" /etc/default/nis { echo "255.0.0.0 127.0.0.0" echo "$NETMASK $NETWORK" } > /etc/ypserv.securenets
- Run:
service nis restart /usr/lib/yp/ypinit -s <name-of-nis-master-server> echo -e '20 * * * * root /usr/lib/yp/ypxfr_1perhour >/dev/null 2>&1\n40 6 * * * root /usr/lib/yp/ypxfr_1perday >/dev/null 2>&1\n55 6,18 * * * root /usr/lib/yp/ypxfr_2perday >/dev/null 2>&1' > /etc/cron.d/nis
- On the master server run: