Configuration and Administration of NIS Server and Client in Solaris
Configuration and Administration of NIS Server and Client in Solaris
Configuration and Administration of NIS Server and Client in Solaris
This article offers background information on NIS as well as the following procedures:
NIS namespace information is stored in files called NIS maps. NIS maps were designed
to supplement many of the UNIX /etc files. These maps store much more than names
and addresses. As a result, the NIS namespace has a large set of maps. NIS maps are
database files created from source files in the /etc directory (or in a directory that you
specify). By default, these maps are stored in the /var/yp/ domainname directory on
NIS servers. For example, the set of maps that contain hosts information include:
hosts.byaddr
hosts.byname
You can obtain a list of the full set of maps from an NIS-configured system by running
the ypwhich -m command.
NIS uses domains to define who can access the host names, user information, and other
administrative data in its namespace. However, NIS does not use a domain hierarchy to
store its data; therefore, the NIS namespace is flat.
NIS provides a forwarding service that forwards host lookups to DNS if the information
cannot be found in an NIS map. The Solaris Operating System also allows you to set up
the nsswitch.conf file, with the following options for lookup requests for hosts:
• Go only to DNS.
• Go to DNS and then to NIS, if the requests are not found by DNS.
• Go to NIS and then to DNS, if the requests are not found by NIS.
NIS uses a client-server arrangement similar to DNS. Replicated NIS servers provide
services to NIS clients. The principal server is called a master server, and, for reliability,
it has a backup, or a slave server. Both master and slave servers use the NIS information
retrieval software and both store NIS maps.
The name service switch file determines which name services a system uses to search for
information, and in which order the name services are searched. Solaris systems use the
/etc/ nsswitch.conf file as the name service switch file. The nsswitch.conf file is
loaded with the contents of a template file during the installation of the Solaris OS,
depending on the name service that is selected, as shown below:
To properly use the name service cache daemon (nscd), you must be able to perform the
following:
The /etc/nscd.conf configuration file controls the behavior of the nscd daemon. The
nscd daemon provides caching for the passwd, group, hosts, ipnodes, exec_attr,
prof_attr, and user_attr databases. Solaris system calls automatically reference the
nscd cache if the nscd cache holds the type of data needed. Standardized calls retrieve
the cached data. The calls take the form of getXbyY, such as gethostbyname,
gethostbyaddr, and so on.
Exercise:
=======
For example:
# domainname sunlab
# cd /etc
# cp nsswitch.nis nsswitch.conf
# vi /etc/hosts
Add the NIS server's information. Always use the server's name in the NIS configuration.
# vi /etc/vfstab
Edit the /export/home entry to /home for the home folder of the client's local user. Use
the /home folder as the local user's home folder.
# vi /etc/auto_master
Comment all lines with # and change the /home entry to /- and change -nobrowse to -
browse.
# vi /etc/auto_home
For example:
/export/home raysvr:/export/home
# automount -v
This will show whether the remote file system is mounted or not. If it shows the
/export/home is already mounted, then unmount / export/home and use the
automount -v command again.
# /usr/lib/netsvc/yp/ypstart
For example:
# domainname sunlab
# cd /etc
# cp nsswitch.nis nsswitch.conf
# vi /etc/hosts
Add the NIS server's information. Always use the server's name in the NIS configuration.
# vi /etc/vfstab
Edit the /export/home entry to /home for the home folder of the client's local user. Use
the /home folder as the local user's home folder.
# vi /etc/auto_master
Comment all lines with # and change the /home entry to /- and change -nobrowse to -
browse.
# vi /etc/auto_home
For example:
/export/home raysvr:/export/home
# automount -v
This will show whether the remote file system is mounted or not. If it shows that
/export/home is already mounted, then unmount / export/home and use the
automount -v command again.
# /usr/lib/netsvc/yp/ypstart
# ypinit - c
Provide the name of the NIS master server. Press 'Ctrl + d' and then press 'y'.
For example:
# ypinit -s raysvr
# ypwhich -m
For example:
# domainname sunlab
# cd /etc
# cp nsswitch.nis nsswitch.conf
# vi /etc/hosts
Add the NIS server's information. Always use the server's name in the NIS configuration.
# vi /etc/vfstab
Edit the /export/home entry to /home for the home folder of the client's local user. Use
the /home folder as the local user's home folder.
# vi /etc/auto_master
Comment all lines with # and change the /home entry to /- and change -nobrowse to -
browse.
# vi /etc/auto_home
For example:
/export/home raysvr:/export/home
# automount -v
This will show whether the remote file system is mounted or not. If it shows the
/export/home is already mounted, then unmount / export/home and use the
automount -v command again.
# /usr/lib/netsvc/yp/ypstart
# ypinit - c
Provide the name of the NIS master server. Press 'Ctrl + d' and then press 'y'.
# ypwhich -m
For example:
# cd /var/yp
# /usr/ccs/bin/make passwd
This command will add the user to the NIS database, and it pushes the database to all
slave servers.
# userdel -r <username>
For example:
# userdel -r test
# cd /var/yp
# /usr/ccs/bin/make passwd
% passwd -r nis
Provide the current password. The new password must differ by a minimum of three
characters from the old one and must be alphanumeric.
Note: In case a user forgets his or her password, there are ways to recover it, but we
recommend just assigning a new one.
# /usr/lib/netsvc/yp/ypstop
# cd /etc
# cp nsswitch.files nsswitch.conf
# rm defaultdomain
# cd /var/yp/bindings
# rm -r <domainname>
# vi /etc/auto_master
Comment the entry that is responsible for remote mount, or comment all entries.
# reboot