![]() |
![]() |
| |||||||||||||||||
Adding Entries to a File-Based MapAdding entries to mymap is simple. First, you must modify the text file /var/yp/mymap.asc. If you modify the actual dbm files without modifying the corresponding text file, the modifications are lost. Then run makedbm as shown above. Creating Maps From Standard InputWhen no original text file exists, create the NIS map from the keyboard by typing input to makedbm, as shown below (end with Control-D).
Modifying Maps Made From Standard InputIf you later need to modify the map, you can use makedbm to disassemble the map and create a temporary text intermediate file. To disassemble the map and create a temporary file, type the following.
The resulting temporary file mymap.temp has one entry per line. You can edit this file as needed, using any text editor. To update the map, give the name of the modified temporary file to makedbm by typing the following.
Then propagate the map to the slave servers, by becoming root and typing the following.
The preceding paragraphs explained how to use makedbm to create maps; however, almost everything you actually have to do can be done by ypinit and Makefile unless you add nondefault maps to the database or change the set of NIS servers after the system is already up and running. Whether you use the Makefile in /var/yp or some other procedure the goal is the same. Anew pair of well-formed dbm files must end up in the maps directory on the master server. Adding a Slave ServerAfter NIS is running, you might need to create an NIS slave server that you did not include in the initial list given to ypinit. To add a NIS slave server:
|
# cd /var/yp/domainname |
Disassemble the ypservers file.
# makedbm -u ypservers >/tmp/temp_file |
The makedbm command converts ypservers from ndbm format to a temporary ASCII file /tmp/temp_file.
Edit the /tmp/temp_file file using a text editor. Add the name of the new slave server to the list of servers. Then save and close the file.
Run the makedbm command with temp_file as the input file and ypservers as the output file.
# makedbm /tmp/temp_file ypservers |
makedbm then converts ypservers back into ndbm format.
Verify that the ypservers map is correct (since there is no ASCII file for ypservers) by typing the following on the slave.
slave3# makedbm -u ypservers |
The makedbm command displays each entry in ypservers on your screen.
Note - If a machine name is not in ypservers, it will not receive updates to the map files because yppush consults this map for the list of slave servers.
Become superuser on the new NIS slave.
Set up the new slave server's NIS domain directory by copying the NIS map set from the master server.
When running the ypinit command, follow the prompts and list the NIS servers in order of preference.
slave3# cd /var/yp slave3# ypinit -c slave3# /usr/lib/netsvc/yp/ypbind |
Initialize this machine as a slave.
slave3# /usr/sbin/ypinit -s ypmaster |
where ypmaster is the machine name of the existing NIS master server.
Run ypstop to stop the machine running as an NIS client.
# /usr/lib/netsvc/yp/ypstop |
Run ypstart to start NIS slave service.
# /usr/lib/netsvc/yp/ypstart |
If the $PWDIR/security/passwd.adjunct file is present, C2 security is started automatically. ($PWDIR is defined in /var/yp/Makefile.) The C2 security mode uses the passwd.adjunct file to create the passwd.adjunct NIS map. In this implementation, NIS allows you to use both the passwd.adjunct file and shadow file to manage security. The passwd.adjunct file is processed only when you type the following.
# make passwd.adjunct
The make passwd command processes the passwd map only, not the passwd.adjunct map when you run make manually in the C2 security mode.
To change the NIS domain name of a machine, do the following.
How to Change a Machine's NIS Domain NameBecome superuser.
Edit the machine's /etc/defaultdomain file, exchanging its present contents with the new domain name for the machine.
For example, if the current domain name is sales.doc.com, you might change it to research.doc.com.
Run domainname `cat /etc/defaultdomain'
Set the machine up as an NIS client, slave, or master server.
See for Chapter 8, Setting Up and Configuring NIS Service for details.
Typically, NIS clients are configured with the nsswitch.conf file to use only NIS for machine name and address lookups. If this type of lookup fails, an NIS server can forward these lookups to DNS.
How to Configure Machine Name and Address Lookup Through NIS and DNSLog into the machine and become a superuser.
The two map files, hosts.byname and hosts.byaddr must include the YP_INTERDOMAIN key. To test this key, edit the Makefile and modify the following lines.
#B=-b B= |
to
B=-b #B= |
makedbm will now start with the -b flag when it makes the maps, and the YP_INTERDOMAIN key will be inserted into the ndbm files.
Run make to rebuild maps.
# /usr/ccs/bin/make hosts |
Check that all the NIS server's /etc/resolv.conf files point to valid nameservers.
Note - If you have NIS servers that are not running Solaris, Release 2, make sure YP_INTERDOMAIN exists in the hosts maps.
To enable DNS forwarding, stop each server.
# /usr/lib/netsvc/yp/ypstop |
Restart each server.
# /usr/lib/netsvc/yp/ypstart |
In this implementation of NIS, ypstart will automatically start the ypserv daemon with the -d option to forward requests to DNS.
Previous Contents Index Next ![]() |