Softpanorama

May the source be with you, but remember the KISS principle ;-)
Contents Bulletin Scripting in shell and Perl Network troubleshooting History Humor

Solaris NIS Daemons

(part 3 of the Solaris NIS mini-tutorial)

Prev

Contents Next

NIS use client server architecture with one master server (and possibly one or several secondary slave servers, necessary for reliability) and many clients. NIS uses several daemons on the server and on all clients to enable the NIS system.

The binding process begins with ypbind sending out a broadcast message for any NIS masters on the network to respond with their IP address and the port number to send requests on. If more than one NIS master responds to the request, only the first received reply is used. If for some reason ypbind finds it isn't getting replies from the NIS master, it assumes that the master has crashed and retransmits a request for a master.

The main daemons involved in the running of an NIS domain are:

You can find out which NIS master any client machine is bound to with the command ypwhich

Configuring an NIS Master

Note – Installations that select Core, End User, or Developer software configuration clusters do not have all of the necessary files in the /usr/lib/netsvc/yp directory to allow a host to function as an NIS server.

Configuring an NIS master is usually straightforward. Begin by verifying the existing files on the master machine, such as /etc/passwd and /etc/group, to ensure that the information is accurate and current. You should remove any expired or unwanted accounts, for example, and verify that all the login directories and commands are correct. While you are examining the /etc/passwd file, check to make sure that all accounts have passwords. If they don't, either assign a password or remove the account. With a network-wide NIS system in place, anyone can exploit these security holes to gain access to any machine on the network, including the NIS master and gateway machines.

Then you need to delete all common user accounts and inset special line into the files to enable NIS include mechanism.  Deletion might actually is not necessary if the insert directive is placed just after all system account.

Once the files are ready for NIS map generation, make sure you are logged in as root (to set the proper ownerships and ensure full access to the filesystem).

The initial set of  NIS maps can be generated from the standard UNIX files, using the ypinit command with the -m option. The -m option indicates that this machine is the NIS master. From the root prompt, issue the following command:

/usr/sbin/ypinit -m

The path to the ypinit program might be different on your UNIX system. Check the path if the command produces an error message when trying to execute.

When the ypinit command executes, it scans all the NIS files named in the file /var/yp and produces the NIS maps that are used by the client processes. The /var/yp file might have a different directory name on some systems, such as SCO UNIX, which uses /etc/yp as a directory for all NIS files. Check your UNIX system documentation or man pages for proper file locations. The /var/yp file contains a list of all the maps to be generated, and usually you do not have to make any changes to this file.

A new directory (usually called /var/yp/domainname, where domainname is the NIS domain name) is created. The maps are placed in this new directory. If you are Configuring more than one domain all handled by the same NIS master machine, the maps for each domain are beneath the domain name's subdirectory.

As the last step in ypinit, you are asked which machines are NIS slave servers, at which point you should enter their names. The slave names are saved in a file in the domain directory.

After the maps have been generated properly, you can start the ypserv daemon and test the service. It is best to automate the startup by editing the startup rc files to do this for you when the machine boots. There is a section in an rc file (usually the one that starts RPC) that looks like this:

if [ -f /etc/yp/ypserv -a -d /var/yp/`domainname` ]; then

  /etc/yp/ypserv

fi

This script checks for the existence of the directory /var/yp/domainname, where domainname is the domain name for your NIS domain. The entry on the first line where domainname is located must be in single back quotes, which means the shell should execute the domainname command and use the results. If the directory exists, the ypserv daemon is started.

To manually start the ypserv daemon, log in as root and issue the command

/etc/yp/ypserv

or whatever the path to your ypserv daemon is.

Next, you need to start the ypbind daemon on the server, too (otherwise, ypserv can't find the maps). Again, this is usually done through the rc startup scripts with an entry like this:

if [ -d /var/yp ]

then

 /etc/yp/ypbind

fi

Again, you should verify that the directory path is correct. You can start the ypbind daemon manually by issuing it on the command line when logged in as root. Make sure the directory path is correct when you do so.

If you want to perform a quick test of the NIS daemons, issue a command like this one at the command line:

ypmatch joeuser passwd

The ypmatch command asks NIS to use the maps to match up the next argument with the map of the third argument's name. In this example, ypmatch is instructed to look in the passwd file (passwd is the alias to passwd.byname) for the entry for joseuser. You should get back the line that matches. You can use any combination of map alias and entry that you know exists to test the NIS server daemon.

To set up the NIS name service master server, perform the following steps:

  1. Determine which machines on your network domain will be NIS servers. There can be one NIS master server and as many NIS slave servers as needed. All systems within the domain are NIS clients.
     

  2. Copy the /etc/nsswitch.nis file to the /etc/nsswitch.conf file. If necessary, modify the file.
     

  3. Choose an NIS domain name. This is usually less than 32 characters in length. (The maximum length is 256 characters, and it is case sensitive.)  Enter the domainname command to set the local NIS domain.

    # domainname domainname

    For example:

    # domainname classroom.central.sun.com

     

  4. Create an /etc/defaultdomain file with the domain name. You must maintain the format established by the original files and update the text files in the /etc directory (all of the files that are used for NIS maps) on the master server with information about the domain.

    Note – You can also copy the network information files to some other location on the system and modify them there rather than modifying them in the /etc directory.
     

  5. If the files do not already exist, use the touch command to create zero-length files with the following names:

    These files are necessary for the creation of the complete set of NIS maps as directed in the Makefile file. When you initialize NIS, you receive error messages for each of these files if they do not exist.
     

  6.  Install an updated Makefile file in the /var/yp directory if you intend to use NIS on the system that functions as your JumpStart™ server. Doing this installation provides entries that create a map for the /etc/locale file.

    Note – The lab at the end of this module shows you how to create the updated Makefile file.
     

  7. Create or populate the /etc/locale file, and make an entry for each domain on your network using the following format:

    domainname locale

    For example:

    classroom.central.sun.com en_us
     

  8. Initialize the master server by using the local /etc files with the ypinit -m command.

    ypinit -m

    1. When the program prompts you for a list of slave servers and after you complete your list, press Control-D. You can make entries for all slaves now, or you can rerun the ypinit -m command after you determine whether you need more or less slave servers.
       
    2. The program asks if you want to terminate it on the first fatal error. If you answer n, the procedure reports any error and attempts to complete the creation of the NIS database files. If you answer y, the process aborts with the first error. You can correct the error and restart the ypinit program.

    The following example shows the text feedback displayed as the program begins:

    ypinit -m

    In order for NIS to operate successfully, we have to construct a list of the NIS servers. Please continue to add the names for YP servers in order of preference, one per line. When you are done with the list, type a <control D> or a return on a line by itself.

    next host to add: server1

    next host to add: <Control-D>

    The current list of yp servers looks like this:
  9. server1

    Is this correct? [y/n: y] y

    Installing the YP database will require that you answer a few questions. Questions will all be asked at the beginning of the procedure.

    Do you want this procedure to quit on non-fatal errors? [y/n: n] n

    OK, please remember to go back and redo manually whatever fails. If you don't, some part of the system (perhaps the yp itself) won't work.

    Note – If you have to restart the ypinit program, you are prompted to destroy the /var/yp/domainname directory. Answer y.
     

  10. Start the NIS daemons on the master server with the following command:

    /usr/lib/netsvc/yp/ypstart
     

  11. If you want to stop the NIS service running on the NIS master, perform the command:

    /usr/lib/netsvc/yp/ypstop

Configuring NIS Slaves

A single NIS server may be a slave of more than one master server, if it is providing service to multiple domains. In addition, a server may be a master for one domain and a slave of another.

To set up an NIS slave, the NIS master must be configured and running. When you are sure the master is operational, log in as root to the machine to be set up as the NIS slave. The domain name of the slave must be properly set before the configuration can proceed, so check the startup rc commands for the entry that sets the domainname variable or use the domainname command to set the domain name. To set up the NIS slave and propagate the NIS files from the master to the slave, issue the command

/etc/yp/ypbind

substituting for whatever path is correct on your system. Check that the binding to the master is correct by issuing the ypwhich command. It should return the NIS master name.

Finally, issue the command

/etc/yp/ypinit -s servername

where the path is correct and servername is the name of your NIS master. The ypbind -s option sets the local machine up as a slave. The ypbind command sets up directories on the local machine and transfers all the maps from the master to the slave.

After the setup is complete, you can test the slave setup with the ypmatch command, as shown in the previous section.

To update the maps on the slaves at regular intervals, the ypxfr command is used on the slave, followed by the name of the map to be transferred. For example the command

ypxfer passwd.byname

transfers the passwd.byname file from the master to the slave. Most administrators create a set of cron entries for transferring all the NIS files at regular intervals (such as nightly). You can also use a script file executed by a network administrator.

You should have at least one NIS slave server to provide backup if the NIS master server becomes unavailable. To configure an NIS slave server, complete the following steps on the system that you want to designate as the slave server:

  1. Copy the /etc/nsswitch.nis file to the /etc/nsswitch.conf file. If necessary, modify the file.
  2. Edit the /etc/hosts file to ensure that the NIS master and all NIS slave servers have been defined.
  3. Execute the domainname command to set the local NIS domain.

    # domainname domainname

    For example:

    # domainname classroom.Central.Sun.COM


  4. Create or populate the /etc/defaultdomain file with the domain name.

  5. Initialize the system as an NIS client by performing the command:
    # ypinit -c

  6. When the system prompts for a list of NIS servers, enter the NIS master host followed by the name of the local host and all other NIS slave servers on the local network.

  7. On the NIS master, ensure that the ypserv process is running by performing the command:
    # ps -ef | grep ypserv

    If it is not running, refer to the previous section on how to start NIS daemons on the master.

  8. Return to the proposed NIS slave system, and enter the ypstart command to start the ypbind daemon.

    # /usr/lib/netsvc/yp/ypstart

  9. Initialize the system as an NIS slave by performing the command:

    # ypinit -s master where masteris the name of the NIS master.

    Note – If you did not add the name of the NIS slave server when you initially configured the NIS master server using the ypinit command, enter the ypinit -m command once more on the NIS master server. In the process of updating the NIS master, the script prompts you for confirmation when it is about to destroy the existing domain database. Confirm by entering y.

  10. To start the ypserv daemon on the slave server, perform the command:

    # /usr/lib/netsvc/yp/ypstart
     

  11. To test NIS functionality on the newly configured NIS slave server, perform the command:
    # ypwhich -m

    The output shows a list of maps together with the NIS master server for each map.

 

Testing the NIS Service

There are a number of commands that you can use to obtain information from and about the NIS database. You can also use these commands to test the functionality of the NIS service. You do not have to be the superuser to use these commands.

The most commonly used NIS commands are: ypcat, ypmatch, ypwhich.

$ ypwhich -m
...
<output truncated>
...
timezone.byname alpha
netmasks.byaddr alpha
netid.byname alpha
bootparams alpha
netgroup.byhost alpha
netgroup.byuser alpha
netgroup alpha
...
<output truncated>

...

Configuring the NIS Client

All systems within an NIS domain that are not configured as servers are configured as clients. To configure the NIS client, complete the following steps:

  1.  Copy the /etc/nsswitch.nis file to the /etc/nsswitch.conf file. If necessary, modify the file.
  2.  Edit the /etc/hosts file to ensure that the NIS master server and all slave servers have been defined.
  3.  Execute the domainname domainname  command to set the local NIS domain. For example:

    # domainname classroom.central.sun.com

  4. Create or populate the /etc/defaultdomain file with the domain name.
     
  5. To initialize the system as an NIS client, perform the command:

    # ypinit -c
     

  6. When the system prompts you for a list of NIS servers, enter the names of the NIS master and all slave servers.

    Note – To exit the ypinit command without building a specific list of NIS servers, press Control-D.

    The client then broadcasts to bind the first available server during subsequent ypbind operations. When not operating in broadcast mode, clients can only bind to servers that are listed in their /var/yp/binding/domainname/ypservers file.
     

  7. Start NIS with the following command:

    # /usr/lib/netsvc/yp/ypstart
     

  8. On the newly configured NIS client, test the NIS functionality by performing the command:

    # ypwhich -m

    The output shows a list of maps together with the NIS master server for each map.

Prev

Contents Next



Etc

FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available in our efforts to advance understanding of environmental, political, human rights, economic, democracy, scientific, and social justice issues, etc. We believe this constitutes a 'fair use' of any such copyrighted material as provided for in section 107 of the US Copyright Law. In accordance with Title 17 U.S.C. Section 107, the material on this site is distributed without profit exclusivly for research and educational purposes.   If you wish to use copyrighted material from this site for purposes of your own that go beyond 'fair use', you must obtain permission from the copyright owner. 

ABUSE: IPs or network segments from which we detect a stream of probes might be blocked for no less then 90 days. Multiple types of probes increase this period.  

Society

Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers :   Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism  : The Iron Law of Oligarchy : Libertarian Philosophy

Quotes

War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda  : SE quotes : Language Design and Programming Quotes : Random IT-related quotesSomerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose BierceBernard Shaw : Mark Twain Quotes

Bulletin:

Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 :  Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method  : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law

History:

Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds  : Larry Wall  : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOSProgramming Languages History : PL/1 : Simula 67 : C : History of GCC developmentScripting Languages : Perl history   : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history

Classic books:

The Peter Principle : Parkinson Law : 1984 : The Mythical Man-MonthHow to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite

Most popular humor pages:

Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor

The Last but not Least


Copyright © 1996-2016 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License.

The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.

Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.

This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...

You can use PayPal to make a contribution, supporting development of this site and speed up access. In case softpanorama.org is down you can use the at softpanorama.info

Disclaimer:

The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the author present and former employers, SDNP or any other organization the author may be associated with. We do not warrant the correctness of the information provided or its fitness for any purpose.

Last modified: June 04, 2016