<?Pub UDT _bookmark _target?><chapter id="cnis1-25208"><?Pub Tag atict:info tracking="on" ref="0"?><?Pub Tag atict:user user="sharonr" fullname="Sharon Veach"?><?Pub Tag atict:user
user="mseif" fullname=""?><title>Setting Up and Configuring NIS Service</title><highlights><para>This chapter describes initial set up and configuration of the Network
Information Service (NIS).</para><note><para>In some contexts, <emphasis>machine</emphasis> names are referred
to as <emphasis>host</emphasis> names or <emphasis>machine</emphasis> names.
This discussion uses &ldquo;machine,&rdquo; but some screen messages or NIS
map names might use <emphasis>host</emphasis> or <emphasis>machine</emphasis>.</para>
</note><para>This chapter covers the following topics.</para><itemizedlist><listitem><para><olink targetptr="cnis1-49" remap="internal">Configuring NIS Task Map</olink></para>
</listitem><listitem><para><olink targetptr="cnis1-35918" remap="internal">Before You Begin Configuring
NIS</olink></para>
</listitem><listitem><para><olink targetptr="cnis1-32365" remap="internal">Planning Your NIS Domain</olink></para>
</listitem><listitem><para><olink targetptr="cnis1-21774" remap="internal">Preparing the Master Server</olink></para>
</listitem><listitem><para><olink targetptr="cnis1-37475" remap="internal">Starting and Stopping NIS Service
on the Master Server</olink></para>
</listitem><listitem><para><olink targetptr="cnis1-16428" remap="internal">Setting Up NIS Slave Servers</olink></para>
</listitem><listitem><para><olink targetptr="cnis1-19866" remap="internal">Setting Up NIS Clients</olink></para>
</listitem>
</itemizedlist>
</highlights><sect1 id="cnis1-49"><title>Configuring NIS Task Map</title><informaltable frame="topbot"><tgroup cols="2" colsep="0" rowsep="0"><colspec colname="colspec2" colwidth="37.88*"/><colspec colname="colspec3" colwidth="62.12*"/><thead><row rowsep="1"><entry><para>Task</para>
</entry><entry><para>For Instructions, Go To</para>
</entry>
</row>
</thead><tbody><row><entry><para>Prepare source files for conversion.</para>
</entry><entry><para><olink targetptr="cnis1-6" remap="internal">Preparing Source Files for Conversion to
NIS Maps</olink></para>
</entry>
</row><row><entry colname="colspec2"><para>Set up master server using <command>ypinit</command></para>
</entry><entry colname="colspec3"><para><olink targetptr="cnis1-28187" remap="internal">Setting Up the Master Server With ypinit</olink></para>
</entry>
</row><row><entry colname="colspec2"><para>Start NIS on master server.</para>
</entry><entry colname="colspec3"><para><olink targetptr="cnis1-37475" remap="internal">Starting and Stopping NIS Service on
the Master Server</olink></para>
</entry>
</row><row><entry colname="colspec2"><para>Set up slave servers.</para>
</entry><entry colname="colspec3"><para><olink targetptr="cnis1-28" remap="internal">Setting Up a Slave Server</olink></para>
</entry>
</row><row><entry colname="colspec2"><para>Set up NIS client.</para>
</entry><entry colname="colspec3"><para><olink targetptr="cnis1-19866" remap="internal">Setting Up NIS Clients</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="cnis1-35918"><title>Before You Begin Configuring NIS</title><indexterm><primary>NIS</primary><secondary>setup, preparation for</secondary>
</indexterm><indexterm><primary>setup</primary><secondary>NIS setup, preparation for</secondary>
</indexterm><para>Before configuring your NIS namespace, you must do the following.</para><itemizedlist><listitem><para><indexterm><primary><filename>nsswitch.conf</filename> files</primary></indexterm>Install properly configured <filename>nsswitch.conf</filename> files
on all the machines that will be using NIS. See <olink targetptr="a12swit-86415" remap="internal">Chapter&nbsp;2, The Name Service Switch (Overview)</olink> for details.</para>
</listitem><listitem><para>Plan your NIS domain.</para>
</listitem>
</itemizedlist>
</sect1><sect1 id="cnis1-55"><title>NIS and the Service Management Facility</title><indexterm><primary>New Features</primary><secondary>Service Management Facility with NIS</secondary>
</indexterm><indexterm><primary>Service Management Facility</primary><secondary>and NIS</secondary>
</indexterm><indexterm><primary>NIS</primary><secondary>Service Management Facility</secondary>
</indexterm><para>The NIS service is managed by the Service Management Facility. For an
overview of SMF, refer to <olink targetdoc="sysadv1" targetptr="hbrunlevels-25516" remap="external">Chapter 16, <citetitle remap="chapter">Managing Services (Overview),</citetitle> in <citetitle remap="book">System Administration Guide: Basic Administration</citetitle></olink>. Also refer to the <olink targetdoc="group-refman" targetptr="svcadm-1m" remap="external"><citerefentry><refentrytitle>svcadm</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> and <olink targetdoc="group-refman" targetptr="svcs-1" remap="external"><citerefentry><refentrytitle>svcs</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man pages for more details.</para><itemizedlist><listitem><para>Administrative actions on this service, such as enabling,
disabling, or restarting, can be performed by using the <command>svcadm</command> command.
However, <command>ypstart</command> and <command>ypstop</command> can also
be used from the command line to start or stop NIS. See the <olink targetdoc="group-refman" targetptr="ypstart-1m" remap="external"><citerefentry><refentrytitle>ypstart</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> and <olink targetdoc="group-refman" targetptr="ypstop-1m" remap="external"><citerefentry><refentrytitle>ypstop</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man pages
for more information.</para><tip><para><indexterm><primary>FMRI</primary><secondary>NIS</secondary></indexterm>Temporarily disabling a service by using the <option>t</option> option
provides some protection for the service configuration. If the service is
disabled with the <option>t</option> option, the original settings would be
restored for the service after a reboot. If the service is disabled without <option>t</option>, the service will remain disabled after reboot.</para>
</tip>
</listitem><listitem><para>The NIS Fault Managed Resource Identifiers (FMRIs) are <literal>svc:/network/nis/server:</literal><replaceable>&lt;instance&gt;</replaceable><literal></literal> for
the NIS server and <literal>svc:/network/nis/client:</literal><replaceable>&lt;instance&gt;</replaceable><literal></literal> for the NIS client.</para>
</listitem><listitem><para>You can query the status of NIS by using the <command>svcs</command> command.</para><itemizedlist><listitem><para>Examples of <command>svcs</command> command and output.</para><screen># <userinput>svcs network/nis/server</userinput>
STATE        STIME    FMRI
online       Jan_10   svc:/network/nis/server:default</screen><screen># <userinput>svcs \*nis\*</userinput>
STATE          STIME    FMRI
disabled       12:39:18 svc:/network/rpc/nisplus:default
disabled       12:39:18 svc:/network/nis/server:default
disabled       12:39:20 svc:/network/nis/passwd:default
disabled       12:39:20 svc:/network/nis/update:default
disabled       12:39:20 svc:/network/nis/xfr:default
online         12:42:16 svc:/network/nis/client:default</screen>
</listitem><listitem><para>Example of <command>svcs</command> <option>l</option> command
and output.</para><screen># <userinput>svcs</userinput> <option>l</option> <userinput>/network/nis/client</userinput>
fmri         svc:/network/nis/client:default
enabled      true
state        online
next_state   none
restarter    svc:/system/svc/restarter:default
contract_id  99
dependency   exclude_all/none svc:/network/nis/server (offline)
dependency   require_all/none svc:/system/identity:domain (online)
dependency   require_all/restart svc:/network/rpc/bind (online)
dependency   require_all/none svc:/system/filesystem/minimal (online)</screen>
</listitem><listitem><para>You can use the <command>svccfg</command> utility to get more
detailed information about a service. See the <olink targetdoc="group-refman" targetptr="svccfg-1m" remap="external"><citerefentry><refentrytitle>svccfg</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.</para>
</listitem><listitem><para>You can check a daemon's presence by using the <command>ps</command> command.</para><screen># <userinput>ps</userinput> <option>e</option> <userinput>| grep rpcbind</userinput>
daemon 100806      1   0   Sep 01 ?       25:28   /usr/sbin/rpcbind</screen><note><para>Do not use the <option>f</option> option with <command>ps</command> because
this option attempts to translate user IDs to names, which causes more naming
service lookups that might not succeed.</para>
</note>
</listitem>
</itemizedlist>
</listitem>
</itemizedlist>
</sect1><sect1 id="cnis1-32365"><title>Planning Your NIS Domain</title><para>Before you configure machines as NIS servers or clients, you must plan
the NIS domain.</para><para>Decide which machines will be in your NIS domain. An NIS domain does
not have to be congruent with your network. A network can have more than one
NIS domain, and there can be machines on your network that are outside of
your NIS domain.</para><para><indexterm><primary>NIS</primary><secondary>domain names</secondary></indexterm><indexterm><primary>domains</primary><secondary>NIS</secondary></indexterm>Choose an NIS domain name, which can be 256 characters long. A
good practice is to limit domain names to no more than 32 characters. Domain
names are case-sensitive. For convenience, you can use your Internet domain
name as the basis for your NIS domain name. For example, if your Internet
domain name is <literal>doc.com</literal>, you can name your NIS domain <literal>doc.com.</literal> If you wanted to divide <literal>doc.com</literal> into
two NIS domains, one for the sales department and the other for the manufacturing
department, you could name one <literal>sales.doc.com</literal> and the other <literal>manf.doc.com.</literal></para><para><indexterm><primary><filename>/etc/nodename</filename> files</primary></indexterm><indexterm><primary><filename>nodename</filename>files</primary></indexterm><indexterm><primary><filename>/etc/defaultdomain</filename> files</primary></indexterm><indexterm><primary><filename>defaultdomain</filename> files</primary></indexterm>Before a machine can use NIS services, the correct NIS domain
name and machine name must be set. A machine's name is set by the machine's <filename>/etc/nodename</filename> file and the machine's domain name is set by the
machine's <filename>/etc/defaultdomain</filename> file. These files are read
at boot time and the contents are used by the <command>uname <option>S</option></command> and <command>domainname</command> commands, respectively. Diskless machines read these
files from their boot server.</para><sect2 id="cnis1-4"><title>Identify Your NIS Servers and Clients</title><para>Select one machine to be the master server. Decide which machines, if
any, will be slave servers.</para><para>Decide which machines will be NIS clients. Typically all machines in
your domain are set to be NIS clients, although this is not necessary.</para>
</sect2>
</sect1><sect1 id="cnis1-21774"><title>Preparing the Master Server</title><para>The following sections describe how to prepare the source files and
the <filename>passwd</filename> files for the master server.</para><sect2 id="cnis1-39121"><title>Source Files Directory</title><indexterm><primary>NIS</primary><secondary>setup, preparation for</secondary>
</indexterm><indexterm><primary>setup</primary><secondary>NIS setup, preparation for</secondary>
</indexterm><indexterm><primary>servers</primary><secondary>NIS, preparing</secondary>
</indexterm><indexterm><primary>NIS</primary><secondary>source files</secondary>
</indexterm><indexterm><primary>NIS</primary><secondary>password data</secondary>
</indexterm><indexterm><primary>password data</primary><secondary>NIS</secondary>
</indexterm><indexterm><primary>security</primary><secondary>NIS</secondary>
</indexterm><indexterm><primary><filename>Makefile</filename> file</primary><secondary>changing source directory</secondary>
</indexterm><indexterm><primary><filename>/var/yp</filename> directory</primary>
</indexterm><para>The source files should be located in the <filename>/etc</filename> directory,
on the master server or in some other directory. Having them in <filename>/etc</filename> is
undesirable because the contents of the maps are then the same as the contents
of the local files on the master server. This is a special problem for <filename>passwd</filename> and <filename>shadow</filename> files because all users
have access to the master server maps and the root password would be passed
to all NIS clients through the <filename>passwd</filename> map. See <olink targetptr="cnis1-17550" remap="internal">Passwd Files and Namespace Security</olink> for additional
information.</para><para>However, if you put the source files in some other directory, you must
modify the <filename>Makefile</filename> in <filename>/var/yp</filename> by
changing the <literal>DIR=/etc</literal> line to <literal>DIR=/</literal><replaceable>your-choice</replaceable>, where <replaceable>your-choice</replaceable> is
the name of the directory you will be using to store the source files. This
allows you to treat the local files on the server as if they were those of
a client. (It is good practice to first save a copy of the original <filename>Makefile</filename>.)</para><para>In addition, if <literal>audit_user</literal>, <literal>auth_attr</literal>, <literal>exec_attr</literal> and <literal>prof_attr</literal> are to be taken from
a directory other than the default, you must amend the <filename>RBACDIR</filename> <parameter>=/etc/security</parameter> to <parameter>RBACDIR=/your-choice</parameter>.</para>
</sect2><sect2 id="cnis1-17550"><title><literal>Passwd</literal> Files and Namespace
Security</title><indexterm><primary>NIS</primary><secondary>password data</secondary>
</indexterm><indexterm><primary>password data</primary><secondary>NIS</secondary>
</indexterm><indexterm><primary>security</primary><secondary>NIS</secondary>
</indexterm><para><indexterm><primary><filename>passwd</filename> map</primary></indexterm>The <filename>passwd</filename> map is a special case. In addition to the old Solaris 1 <filename>passwd</filename> file format, this implementation of NIS accepts the <filename>/etc/passwd</filename>  and <filename>/etc/shadow</filename> file formats as input for
building the NIS password maps.</para><para>For security reasons, the files used to build the NIS password maps
should not contain an entry for <literal>root</literal>, to prevent unauthorized
root access. Therefore, the password maps should not be built from the files
located in the master server's <filename>/etc</filename> directory. The password
files used to build the password maps should have the <literal>root</literal> entry
removed from them and be located in a directory that can be protected from
unauthorized access.</para><para>For example, the master server password input files should be stored
in a directory such as <filename>/var/yp</filename>, or any directory of your
choice, as long as the file itself is not a link to another file and its location
is specified in the <literal>Makefile</literal>. The correct directory option
is set automatically according to the configuration specified in your <filename>Makefile</filename>.</para><caution><para>Be sure that the <filename>passwd</filename> file in the directory
specified by <systemitem class="resource">PWDDIR</systemitem> does not contain
an entry for root.</para>
</caution><para><indexterm><primary><systemitem class="macro">PWDIR</systemitem></primary></indexterm>If your source files are in a directory other than <filename>/etc</filename>,
you must alter the <systemitem class="macro">PWDIR</systemitem> password macro
in the <filename>Makefile</filename> to refer to the directory where the <filename>passwd</filename> and <filename>shadow</filename> files reside, changing the
line <literal>PWDIR=/etc</literal> to <literal>PWDIR/</literal><replaceable>your-choice</replaceable>, where <replaceable>your-choice</replaceable> is the name of
the directory you will be using to store the <filename>passwd</filename> map
source files.</para>
</sect2><sect2 id="cnis1-6"><title>Preparing Source Files for Conversion to NIS Maps</title><indexterm><primary>NIS</primary><secondary>source files</secondary>
</indexterm><para>Prepare the source files for conversion to NIS maps.</para><task id="cnis1-proc-7"><title>How to Prepare Source Files for Conversion</title><procedure><step id="cnis1-step-50"><para>Become superuser or assume an equivalent role.</para><para>Roles contain authorizations and privileged commands. For more information
about roles, see <olink targetdoc="sysadv6" targetptr="rbactask-1" remap="external">Chapter 9, <citetitle remap="chapter">Using Role-Based Access Control (Tasks),</citetitle> in <citetitle remap="book">System Administration Guide: Security Services</citetitle></olink>.</para>
</step><step id="cnis1-step-8"><para>Check the source files on the master server
to make sure they reflect an up-to-date picture of your system.</para><para>Check
the following files:</para><itemizedlist><listitem><para><filename>auto.home</filename> or <filename>auto_home</filename></para>
</listitem><listitem><para><filename>auto.master</filename> or <filename>auto_master</filename></para>
</listitem><listitem><para><filename>audit_user</filename></para>
</listitem><listitem><para><filename>auth_attr</filename></para>
</listitem><listitem><para><filename>bootparams</filename></para>
</listitem><listitem><para><filename>ethers</filename></para>
</listitem><listitem><para><filename>exec_attr</filename></para>
</listitem><listitem><para><filename>group</filename></para>
</listitem><listitem><para><filename>hosts</filename></para>
</listitem><listitem><para><filename>ipnodes</filename></para>
</listitem><listitem><para><filename>netgroup</filename></para>
</listitem><listitem><para><filename>netmasks</filename></para>
</listitem><listitem><para><filename>networks</filename></para>
</listitem><listitem><para><filename>passwd</filename></para>
</listitem><listitem><para><filename>protocols</filename></para>
</listitem><listitem><para><filename>rpc</filename></para>
</listitem><listitem><para><filename>service</filename></para>
</listitem><listitem><para><filename>shadow</filename></para>
</listitem><listitem><para><filename>user_attr</filename></para>
</listitem>
</itemizedlist>
</step><step id="cnis1-step-9"><para><indexterm><primary><filename>DIR</filename> directory</primary></indexterm>Copy all of these source files, except <filename>passwd</filename>,
to the <filename>DIR</filename> directory that you have selected.</para>
</step><step id="cnis1-step-9a"><para>Copy the <filename>passwd</filename> file to
the <filename>PWDIR</filename> directory that you have selected.</para>
</step><step id="cnis1-step-1"><para>Copy <filename>audit_user</filename>, <filename>auth_attr</filename>, <filename>exec_attr</filename>, and <filename>prof_attr</filename> to
the selected <filename>RBACDIR</filename> directory.</para>
</step><step id="cnis1-step-10"><para><indexterm><primary><filename>/etc/mail/aliases</filename> files</primary></indexterm><indexterm><primary><filename>aliases</filename> files</primary></indexterm>Check the <filename>/etc/mail/aliases</filename> file.</para><para><indexterm><primary><filename>/etc/mail</filename> directory</primary></indexterm>Unlike
other source files, the <filename>/etc/mail/aliases</filename> file cannot
be moved to another directory. This file must reside in the <filename>/etc/mail</filename> directory.
Refer to <olink targetdoc="group-refman" targetptr="aliases-4" remap="external"><citerefentry><refentrytitle>aliases</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> for
more information. </para><note><para>You can add a nis-specific mail aliases file by pointing the <literal>ALIASES = /etc/mail/aliases</literal> entry in <filename>/var/yp/Makefile</filename> to
another location. When you then run a <command>make</command>, the <literal>ALIASES</literal> entry creates a <literal>mail.aliases</literal> map. The <command>sendmail</command> service uses this map in addition to the <filename>/etc/mail/aliases</filename> file
when the <filename>/etc/nsswitch.conf</filename> file properly targets <literal>nis</literal> in addition to <literal>files</literal>. Refer to <olink targetptr="anis2-20638" remap="internal">Modifying and Using the Makefile</olink>.</para>
</note>
</step><step id="cnis1-step-11"><para>Clean all comments and other extraneous lines
and information from the source files.</para><para><indexterm><primary><filename>Makefile</filename> file</primary><secondary>conversion to NIS and</secondary></indexterm>These operations can be done through a <command>sed</command> or <command>awk</command> script or with a text editor. The <filename>Makefile</filename> performs
some file cleaning automatically for you, but it is good practice to examine
and clean these files by hand before running. </para>
</step><step id="cnis1-step-12"><para>Make sure that the data in all the source files
is correctly formatted.</para><para>Source file data needs to be in the correct
format for that particular file. Check the man pages for the different files
to make sure that each file is in the correct format.</para>
</step>
</procedure>
</task>
</sect2><sect2 id="cnis1-29190"><title>Preparing the <filename>Makefile</filename></title><indexterm><primary>NIS</primary><secondary>makefile preparation</secondary>
</indexterm><indexterm><primary>setup</primary><secondary>NIS makefile</secondary>
</indexterm><para><indexterm><primary><command>ndbm</command></primary></indexterm><indexterm><primary><command>ypinit</command> command</primary><secondary><filename>Makefile</filename> file and</secondary></indexterm>After checking the source files
and copying them into the source file directory, you now need to convert those
source files into the <command>ndbm</command> format maps that the NIS service
uses. This is done automatically for you by <command>ypinit</command> when
called on the master server, as explained in <olink targetptr="cnis1-28187" remap="internal">Setting
Up the Master Server With ypinit</olink>.</para><para><indexterm><primary><filename>Makefile</filename> file</primary><secondary>preparing</secondary></indexterm><indexterm><primary><filename>/var/yp</filename> directory</primary></indexterm>The <command>ypinit</command> script
calls the program <command>make</command>, which uses the <filename>Makefile</filename> located
in the <filename>/var/yp</filename> directory. A default <filename>Makefile</filename> is
provided for you in the <filename>/var/yp</filename> directory and contains
the commands needed to transform the source files into the desired <command>ndbm</command> format
maps.</para><para>You can use the default <filename>Makefile</filename> as it is, or modify
it if you want. (If you do modify the default <filename>Makefile</filename>,
be sure to first copy and store the original default <filename>Makefile</filename> in
case you need it for future use.) You might need to make one or more of the
following modifications to the <filename>Makefile</filename>:</para><itemizedlist><listitem><para><emphasis>Nondefault maps</emphasis></para><para>If you have
created your own non-default source files and want to convert them to NIS
maps, you must add those source files to the <filename>Makefile</filename>.</para>
</listitem><listitem><para><systemitem class="resource">DIR</systemitem> <emphasis>value</emphasis></para><para>If you want the <filename>Makefile</filename> to use source files stored
in some directory other than <filename>/etc</filename>, as explained in <olink targetptr="cnis1-39121" remap="internal">Source Files Directory</olink>, you must change the
value of <systemitem class="resource">DIR</systemitem> in the <filename>Makefile</filename> to
the directory that you want to use. When changing this value in the <filename>Makefile</filename>, do not indent the line.</para>
</listitem><listitem><para><systemitem class="resource">PWDIR</systemitem> <emphasis>value</emphasis></para><para><indexterm><primary><filename>adjunct</filename> files</primary></indexterm><indexterm><primary><filename>Makefile</filename> file</primary><secondary>changing source directory</secondary></indexterm>If you want the <filename>Makefile</filename> to use <filename>passwd</filename>, <filename>shadow</filename>,
and/or <filename>adjunct</filename> source files stored in some directory
other than <filename>/etc</filename>, you must change the value of <systemitem class="resource">PWDIR</systemitem> in the <filename>Makefile</filename> to
the directory that you want to use. When changing this value in the <filename>Makefile</filename>, do not indent the line.</para>
</listitem><listitem><para><emphasis>Domain name resolver</emphasis></para><para>If you
want the NIS server to use the domain name resolver for machines not in the
current domain, comment out the <filename>Makefile</filename> line <literal>B=</literal>,
and uncomment (activate) the line <literal>B=</literal><option>b</option><literal></literal>.</para>
</listitem>
</itemizedlist><para><indexterm><primary><filename>mapname.dir</filename> files</primary></indexterm><indexterm><primary><filename>mapname.pag</filename> files</primary></indexterm><indexterm><primary><command>makedbm</command> command</primary><secondary><filename>Makefile</filename> and</secondary></indexterm>The function
of the <filename>Makefile</filename> is to create the appropriate NIS maps
for each of the databases listed under <literal>all</literal>. After passing
through <command>makedbm</command> the data is collected in two files, <filename>mapname.dir</filename> and <filename>mapname.pag</filename>. Both files are
in the <filename>/var/yp/</filename><replaceable>domainname</replaceable> directory
on the master server.</para><para><indexterm><primary><filename>Makefile</filename> file</primary><secondary><literal>passwd</literal> maps and</secondary></indexterm><indexterm><primary><filename>/PWDIR/shadow</filename> file</primary></indexterm><indexterm><primary><filename>shadow</filename> file</primary></indexterm><indexterm><primary><filename>/PWDR/security/passwd.adjunct</filename></primary></indexterm><indexterm><primary><filename>passwd.adjunct</filename> file</primary></indexterm><indexterm><primary><filename>/var/yp/</filename>  directory</primary></indexterm>The <filename>Makefile</filename> builds <literal>passwd</literal> maps
from the <filename>/PWDIR/passwd</filename>, <filename>/PWDIR/shadow</filename>,
and <filename>/PWDIR/security/passwd.adjunct</filename> files, as appropriate.</para>
</sect2><sect2 id="cnis1-28187"><title>Setting Up the Master Server With <command>ypinit</command></title><para><indexterm><primary><command>ypinit</command> command</primary><secondary>master server setup</secondary></indexterm>The <command>ypinit</command> script sets
up master and slave servers and clients to use NIS. It also initially runs <command>make</command> to create the maps on the master server.</para><para>To use <command>ypinit</command> to build a fresh set of NIS maps on
the master server, do the following.</para><task id="cnis1-proc-13"><title>How to set up the master server using <command>ypinit</command></title><procedure><step id="cnis1-step-3"><para>On the master server, become superuser or assume
an equivalent role.</para><para>Roles contain authorizations and privileged
commands. For more information about roles, see <olink targetdoc="sysadv6" targetptr="rbactask-1" remap="external">Chapter 9, <citetitle remap="chapter">Using Role-Based Access Control (Tasks),</citetitle> in <citetitle remap="book">System Administration Guide: Security Services</citetitle></olink>.</para>
</step><step id="cnis1-step-14"><para>Copy the contents of the <filename>nsswitch.files</filename> file
to the <filename>nsswitch.conf</filename> file.</para><screen># <userinput>cp /etc/nsswitch.files /etc/nsswitch.conf</userinput></screen>
</step><step id="cnis1-step-15"><para>Edit the <filename>/etc/hosts</filename> or <filename>/etc/inet/ipnodes</filename> file to add the name and IP address of each of
the NIS servers.</para>
</step><step id="cnis1-step-16"><para>Build new maps on the master server.</para><screen># <userinput>/usr/sbin/ypinit</userinput> <option>m</option><userinput></userinput></screen>
</step><step id="cnis1-step-17"><para><indexterm><primary>NIS</primary><secondary><command>ypinit</command></secondary></indexterm>When <command>ypinit</command> prompts
for a list of other machines to become NIS slave servers, type the name of
the server you are working on, along with the names of your NIS slave servers.</para>
</step><step id="cnis1-step-18"><para>When <command>ypinit</command> asks whether
you want the procedure to terminate at the first nonfatal error or continue
despite nonfatal errors, type <userinput>y</userinput>.</para><para>When you
choose <literal>y</literal>, <command>ypinit</command> exits upon encountering
the first problem; you can then fix it and restart <command>ypinit</command>.
This is recommended if you are running <command>ypinit</command> for the first
time. If you prefer to continue, you can try to manually fix all problems
that occur, and then restart <command>ypinit</command>.</para><note><para>A nonfatal error can appear when some of the map files are not
present. This is not an error that affects the functionality of NIS. You might
need to add maps manually if they were not created automatically. Refer to <olink targetptr="anis1-6" remap="internal">Default NIS Maps</olink> for a description of all default
NIS maps.</para>
</note>
</step><step id="cnis1-step-19"><para><command>ypinit</command> asks whether the
existing files in the <filename>/var/yp/</filename><replaceable>domainname</replaceable> directory
can be destroyed.</para><para>This message is displayed only if NIS has been
previously installed.</para>
</step><step id="cnis1-step-20"><para>After <command>ypinit</command> has constructed
the list of servers, it invokes <command>make</command>.</para><para><indexterm><primary><filename>Makefile</filename> file</primary><secondary>setting up primary server</secondary></indexterm><indexterm><primary><filename>/var/yp/Makefile</filename></primary></indexterm><indexterm><primary><command>makedbm</command> command</primary><secondary><command>ypinit</command> and</secondary></indexterm>This
program uses the instructions contained in the <filename>Makefile</filename> (either
the default one or the one you modified) located in <filename>/var/yp</filename>.
The <command>make</command> command cleans any remaining comment lines from
the files you designated. It also runs <command>makedbm</command> on the files,
creating the appropriate maps and establishing the name of the master server
for each map.</para><para><indexterm><primary><command>domainname</command></primary></indexterm><indexterm><primary><command>make</command> command</primary><secondary><command>ypinit</command> and</secondary></indexterm><indexterm><primary><command>ypinit</command> command</primary><secondary><command>make</command> command and</secondary></indexterm><indexterm><primary><systemitem>DOM</systemitem> variable</primary></indexterm>If the
map or maps being pushed by the <filename>Makefile</filename> correspond to
a domain other than the one returned by the command <command>domainname</command> on
the master, you can make sure that they are pushed to the correct domain by
starting <command>make</command> in the <command>ypinit</command> shell script
with a proper identification of the variable <envar>DOM</envar>, as follows:</para><screen># <userinput>make DOM=<replaceable>domainname</replaceable> <replaceable>password</replaceable></userinput></screen><para>This pushes the <filename>password</filename> map to the intended domain,
instead of the domain to which the master belongs.</para>
</step><step id="cnis1-step-21"><para>To enable NIS as the naming service, type the
following.</para><screen># <userinput>cp /etc/nsswitch.nis /etc/nsswitch.conf</userinput></screen><para>This replaces the current switch file with the default NIS-oriented
switch file. You can edit this file as necessary.</para>
</step>
</procedure>
</task>
</sect2><sect2 id="cnis1-22"><title>Master Supporting Multiple NIS Domains</title><indexterm significance="preferred"><primary>NIS</primary><secondary>domains, multiple</secondary>
</indexterm><indexterm significance="preferred"><primary>setup</primary><secondary>multiple NIS domains</secondary>
</indexterm><indexterm><primary>domains</primary><secondary>NIS, multiple</secondary>
</indexterm><para>Normally, an NIS master server supports only one NIS domain. However,
if you are using a master server to support multiple domains, you must slightly
modify the steps, as described in <olink targetptr="cnis1-28187" remap="internal">Setting Up
the Master Server With ypinit</olink>, when setting up the server to serve
the additional domains.</para><para><indexterm><primary><systemitem>DOM</systemitem> variable</primary></indexterm>Run the <command>domainname</command> command on the server. The
domain name returned by the command is the server's default domain. The steps
described in <olink targetptr="cnis1-28187" remap="internal">Setting Up the Master Server With
ypinit</olink> will work properly for setting up service for that domain.
To configure service for any <emphasis>other</emphasis> domain, you must modify
the <command>ypinit</command> shell script as follows.</para><screen># <userinput>make DOM=<replaceable>correct-domain</replaceable> passwd</userinput></screen><para><replaceable>correct-domain</replaceable> is the name of the other domain
that you are setting up service for, and <literal>passwd</literal> is the <command>make</command> target. This command pushes the <filename>passwd</filename> map
to the intended domain, instead of the domain to which the master belongs.</para>
</sect2>
</sect1><sect1 id="cnis1-37475"><title>Starting and Stopping NIS Service
on the Master Server</title><indexterm significance="preferred"><primary>NIS</primary><secondary>starting</secondary>
</indexterm><indexterm significance="preferred"><primary>setup</primary><secondary>NIS, starting</secondary>
</indexterm><para><indexterm><primary>daemons</primary><secondary>NIS, starting</secondary></indexterm><indexterm><primary>NIS</primary><secondary>daemons, starting</secondary></indexterm><indexterm><primary><command>ypserv</command> daemon</primary></indexterm><indexterm><primary><command>ypbind</command> daemon</primary><secondary>starting NIS</secondary></indexterm><indexterm><primary><command>ypserv</command> daemon</primary></indexterm>Now that the master maps are created,
you can start the NIS daemons on the master server and begin service. When
you enable the NIS service, <command>ypserv</command> and <command>ypbind</command> start
on the server. When a client requests information from the server, <command>ypserv</command> is the daemon that answers information requests from clients after
looking them up in the NIS maps. The <command>ypserv</command> and <command>ypbind</command> daemons are administered as a unit.</para><para>There are three ways that NIS service can be started or stopped on a
server:</para><itemizedlist><listitem><para>By automatically invoking the <command>/usr/lib/netsvc/yp/ypstart</command> script during the boot process</para>
</listitem><listitem><para><indexterm><primary>SMF</primary></indexterm><indexterm><primary>Service Management Facility</primary><see>SMF</see></indexterm>By
using the Service Management Facility <command>svcadm enable</command> <replaceable>&lt;fmri&gt;</replaceable> and <command>svcadm disable</command> <replaceable>&lt;fmri&gt;</replaceable> commands from the command line</para><para>See <olink targetdoc="group-refman" targetptr="svcadm-1m" remap="external"><citerefentry><refentrytitle>svcadm</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> for more
information about SMF.</para>
</listitem><listitem><para>By using the <olink targetdoc="group-refman" targetptr="ypstart-1m" remap="external"><citerefentry><refentrytitle>ypstart</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> and <olink targetdoc="group-refman" targetptr="ypstop-1m" remap="external"><citerefentry><refentrytitle>ypstop</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> commands
from the command line</para>
</listitem>
</itemizedlist><sect2 id="cnis1-23"><title>Starting NIS Service Automatically</title><para><indexterm><primary><command>ypinit</command> command</primary><secondary>starting <command>ypserv</command></secondary></indexterm><indexterm><primary>NIS</primary><secondary>automatic starting</secondary></indexterm>After the NIS master
server has been configured by running <command>ypinit</command>, <command>ypstart</command> is automatically invoked to start up <command>ypserv</command> when
the machine is booted. See <olink targetptr="cnis1-28187" remap="internal">Setting Up the Master
Server With ypinit</olink>.</para>
</sect2><sect2 id="cnis1-24"><title>Starting and Stopping NIS From the Command Line</title><para>Use the Service Management Facility <command>svcadm</command> commands
or the <command>ypstart/ypstop</command> commands to start and stop NIS from
the command line. When using <command>svcadm</command>, the instance name
is needed only if you are running more than one instance of the service. For
more information, see <olink targetptr="cnis1-55" remap="internal">NIS and the Service Management
Facility</olink>, or see the <olink targetdoc="group-refman" targetptr="svcadm-1m" remap="external"><citerefentry><refentrytitle>svcadm</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>, <olink targetdoc="group-refman" targetptr="ypstart-1m" remap="external"><citerefentry><refentrytitle>ypstart</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>, and <olink targetdoc="group-refman" targetptr="ypstop-1m" remap="external"><citerefentry><refentrytitle>ypstop</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man pages.</para><para><indexterm><primary>SMF</primary></indexterm><indexterm><primary>NIS</primary><secondary>starting, command line</secondary></indexterm>To begin NIS service
from the command line, run the <command>svcadm enable</command> command or
the <command>ypstart</command> command.</para><screen># <userinput>svcadm enable network/nis/server:<replaceable>&lt;instance&gt;</replaceable></userinput>
# <userinput>svcadm enable network/nis/client:<replaceable>&lt;instance&gt;</replaceable></userinput>
or
# <userinput>ypstart</userinput></screen><note><para>Because there is a slight delay before <command>ypserv</command> is
ready to respond to calls after startup, you should issue a three to five
second sleep after <command>svcadm</command> when calling it from inside a
program or script.</para>
</note><para><indexterm><primary>SMF</primary></indexterm><indexterm><primary>NIS</primary><secondary>stopping, command line</secondary></indexterm>To stop NIS service,
run the <command>svcadm disable</command> command or the <command>ypstop</command>.</para><screen># <userinput>svcadm disable network/nis/server:<replaceable>&lt;instance&gt;</replaceable></userinput>
# <userinput>svcadm disable network/nis/client:<replaceable>&lt;instance&gt;</replaceable></userinput>
or
# <userinput>ypstop</userinput></screen><para><indexterm><primary>SMF</primary></indexterm><indexterm><primary>NIS</primary><secondary>restarting, command line</secondary></indexterm>To stop and immediately
restart an NIS service, use the <command>svcadm restart</command> command.</para><screen># <userinput>svcadm restart network/nis/server:<replaceable>&lt;instance&gt;</replaceable></userinput>
# <userinput>svcadm restart network/nis/client:<replaceable>&lt;instance&gt;</replaceable></userinput></screen>
</sect2>
</sect1><sect1 id="cnis1-16428"><title>Setting Up NIS Slave Servers</title><indexterm><primary>NIS</primary><secondary>slave server setup</secondary>
</indexterm><indexterm><primary>setup</primary><secondary>NIS slave servers</secondary>
</indexterm><indexterm><primary>servers</primary><secondary>NIS slave setup</secondary>
</indexterm><para>Your network can have one or more slave servers. Having slave servers
ensures the continuity of NIS services when the master server is not available.</para><sect2 id="cnis1-27"><title>Preparing a Slave Server</title><para><indexterm><primary><command>ypinit</command> command</primary><secondary>slave servers and</secondary></indexterm><indexterm><primary><command>domainname</command></primary></indexterm>Before actually running <command>ypinit</command> to create the
slave servers, you should run the <command>domainname</command> command on
each NIS slave to make sure the domain name is consistent with the master
server.</para><note><para>Domain names are case-sensitive.</para>
</note><para><indexterm><primary><command>rcp</command></primary></indexterm>Make
sure that the network is working properly before you configure an NIS slave
server. In particular, check to be sure you can use <command>rcp</command> to
send files from the master NIS server to NIS slaves. </para>
</sect2><sect2 id="cnis1-28"><title>Setting Up a Slave Server</title><indexterm><primary><command>ypinit</command> command</primary><secondary>initializing a slave server</secondary>
</indexterm><indexterm><primary>NIS</primary><secondary>slave server setup</secondary>
</indexterm><indexterm><primary>setup</primary><secondary>NIS slave servers</secondary>
</indexterm><indexterm><primary>servers</primary><secondary>NIS slave setup</secondary>
</indexterm><para>The following procedure shows how to set up a slave server.</para><task id="cnis1-proc-29"><title>How to Set Up a Slave Server</title><procedure><step id="cnis1-step-2"><para>Become superuser or assume an equivalent role.</para><para>Roles contain authorizations and privileged commands. For more information
about roles, see <olink targetdoc="sysadv6" targetptr="rbactask-1" remap="external">Chapter 9, <citetitle remap="chapter">Using Role-Based Access Control (Tasks),</citetitle> in <citetitle remap="book">System Administration Guide: Security Services</citetitle></olink>.</para>
</step><step id="cnis1-step-30"><para><indexterm><primary><filename>/etc/hosts</filename></primary></indexterm><indexterm><primary><filename>hosts</filename> files</primary></indexterm>Edit the <filename>/etc/hosts</filename> or <filename>/etc/inet/ipnodes</filename> file on the slave server to add the name and IP addresses of all
the other NIS servers.</para>
</step><step id="cnis1-step-31"><para><indexterm><primary><filename>/var/yp</filename> directory</primary></indexterm>Change directory to <filename>/var/yp</filename> on
the slave server.</para><note><para>You must first configure the new slave server as an NIS client
so that it can get the NIS maps from the master for the first time. See <olink targetptr="cnis1-19866" remap="internal">Setting Up NIS Clients</olink> for details.</para>
</note>
</step><step id="cnis1-step-32"><para>Initialize the slave server as a client.</para><screen># <userinput>/usr/sbin/ypinit -c</userinput></screen><para>The <command>ypinit</command> command prompts you for a list of NIS
servers. Enter the name of the local slave you are working on first, then
the master server, followed by the other NIS slave servers in your domain
in order from the physically closest to the furthest in network terms. </para>
</step><step id="cnis1-step-33"><para>Determine if the NIS client is running, then
start the client service as needed.</para><screen># <userinput>svcs network/nis/client</userinput>
STATE          STIME     FMRI
online         20:32:56  svc:/network/nis/client:default</screen><para>If <literal>svc:/network/nis/client</literal> is displayed with an <literal>online</literal> state, then NIS is running. If the service state is disabled,
then NIS is not running.</para><substeps><step><para>If the NIS client is running, restart the client service.</para><screen># <userinput>svcadm restart network/nis/client</userinput></screen>
</step><step><para>If the NIS client is not running, start the client service.</para><screen># <userinput>svcadm enable network/nis/client</userinput></screen>
</step>
</substeps>
</step><step id="cnis1-step-34"><para>If NIS is running, stop
and restart the service.</para><screen># <userinput>/usr/lib/netsvc/yp/ypstop</userinput></screen>
</step><step id="cnis1-step-35"><para>Type the following to restart <command>ypbind</command>.</para><screen># <userinput>/usr/lib/netsvc/yp/ypstart</userinput></screen>
</step><step id="cnis1-step-36"><para>Initialize this machine as a slave.</para><screen># <userinput>/usr/sbin/ypinit</userinput> <option>s</option> <userinput><replaceable>master</replaceable></userinput></screen><para>Where <replaceable>master</replaceable> is the machine name of the existing
NIS master server.</para><para>Repeat the procedures described in this section for each machine you
want configured as an NIS slave server.</para>
</step>
</procedure>
</task><task id="cnis1-proc-51"><title>How to Start NIS on a Slave Server</title><tasksummary><para>The following procedure shows how to start NIS on a slave server.</para>
</tasksummary><procedure><step id="cnis1-step-54"><para>Become superuser or assume an equivalent role.</para><para>Roles contain authorizations and privileged commands. For more information
about roles, see <olink targetdoc="sysadv6" targetptr="rbactask-1" remap="external">Chapter 9, <citetitle remap="chapter">Using Role-Based Access Control (Tasks),</citetitle> in <citetitle remap="book">System Administration Guide: Security Services</citetitle></olink>.</para>
</step><step id="cnis1-step-52"><para>Stop the client service
and start all NIS server processes.</para><screen># <userinput>svcadm disable network/nis/client</userinput>
# <userinput>svcadm enable network/nis/server</userinput></screen>
</step>
</procedure>
</task>
</sect2>
</sect1><sect1 id="cnis1-19866"><title>Setting Up NIS Clients</title><indexterm><primary>NIS</primary><secondary>client setup</secondary>
</indexterm><indexterm><primary>setup</primary><secondary>NIS clients</secondary>
</indexterm><indexterm><primary>clients</primary><secondary>NIS setup</secondary>
</indexterm><para>The two methods for configuring a client machine to use NIS as its naming
service are explained below.</para><note><para>The Solaris operating system does not support a configuration
in which a NIS client and a Native LDAP client co-exist on the same client
machine.</para>
</note><itemizedlist><listitem><para><indexterm><primary><command>ypinit</command> command</primary><secondary>client setup</secondary></indexterm><command>ypinit</command>.
The recommended method for configuring a client machine to use NIS is to login
to the machine as <literal>root</literal> and run <command>ypinit <option>c</option></command>.</para><screen># <userinput>ypinit</userinput> <option>c</option><userinput></userinput></screen><para>You will be asked to name NIS servers from which the client obtains
naming service information. You can list as many master or slave servers as
you want. The servers that you list can be located anywhere in the domain.
It is a better practice to first list the servers closest (in network terms)
to the machine, than those that are on more distant parts of the net.</para>
</listitem><listitem><para><indexterm><primary><command>ypbind</command> daemon</primary><secondary>broadcast mode</secondary></indexterm><emphasis>Broadcast method</emphasis>.
An older method of configuring a client machine to use NIS to log in to the
machine as <literal>root</literal>, set the domain name with the <command>domainname</command> command, then run <command>ypbind</command>.</para><para><command>ypstart</command> will automatically invoke the NIS client in broadcast mode (<command>ypbind</command> <option>broadcast</option>), if the <filename>/var/yp/binding/`domainname`/ypservers</filename> file does not exist.</para><screen># <userinput>domainname doc.com</userinput>
# <userinput>mv /var/yp/binding/`domainname`/ypservers /var/yp/binding/`domainname`\</userinput>
<userinput>/ypservers.bak</userinput>
# <userinput>ypstart</userinput></screen><para>When you run <command>ypbind</command>, it searches the local subnet
for an NIS server. If it finds a subnet, <command>ypbind</command> binds to
it. This search is referred to as <emphasis>broadcasting</emphasis>. If there
is no NIS server on the client's local subnet, <command>ypbind</command> fails
to bind and the client machine is not able to obtain namespace data from the
NIS service.</para>
</listitem>
</itemizedlist><note><para>For reasons of security and administrative control it is preferable
to specify the servers a client is to bind to in the client's <filename>ypservers</filename> file rather than have the client search for servers through broadcasting.
Broadcasting slows down the network, slows the client, and prevents you from
balancing server load by listing different servers for different clients.</para>
</note>
</sect1>
</chapter><?Pub *0000049747 0?>