Pick a Free OS

User login

Navigation

NIS on Linux


amd.home: $(AMD_HOME) $(YPDIR)/Makefile

@echo "Updating $@..."

@sed -e "s/#.*$$//" -e "/^$$/d" $(AMD_HOME) |

$(AWK) '{

for (i = 1; i <= NF; i++)

if (i == NF) {

if (substr($$i, length($$i), 1) == "")

printf("%s", substr($$i, 1, length($$i) -1));


else

printf("%sn",$$i);

}

else

printf("%s ",$$i);

}' | $(DBLOAD) -i $(AMD_HOME) -o $(YPMAPDIR)/$@ - $@

@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@


This file, which is rather lengthy, does not need full-fledged editing for our purposes. The strings beginning with $ such as $(YPPWDDIR) are variables set at the top of the file. Thus, $(YPPWDDIR) is set to the path /etc. The string after $(YPPWDDIR) is the name of the file in /etc that will be shared via NIS.


Now, we determine which files are to be shared via NIS. Look at the following group of lines in the file:

all: passwd hosts services protocols networks auto.master

#shadow publickey

# networks ethers bootparams amd.home

#auto.master auto.home passwd.adjunct

These lines indicate that the files passwd, hosts, services, protocols, networks, auto.master are to be shared while those commented out are not be shared.

At this point, we have to construct a list of the hosts, which will run NIS servers.


Now, we initialized the NIS database with the following command:

/usr/lib/yp/ypinit

The output we got was:

goofy is in the list of NIS server hosts. Please continue to add the names for the other hosts, one per line. When you are done with the list, type a <control D>.

next host to add: goofy

next host to add:

The current list of NIS servers looks like this:

goofy

Is this correct? [y/n: y] We need some minutes to build the databases...

Building /var/yp/goofy.disney.com/ypservers...

Running /var/yp/Makefile...

gmake[1]: Entering directory '/var/yp/goofy.disney.com'

Updating passwd.byname...

Updating passwd.byuid...

Updating hosts.byname...

Updating hosts.byaddr...

Updating services.byname...

Updating protocols.bynumber...

Updating protocols.byname...

Updating networks.byaddr...

Updating networks.byname...