Monday, February 28, 2011

NIS Configurations

What is NIS:

       network information service (NIS): Client-server protocol that tracks, manages,
and authenticates users and host names on a network. Network Information Service (NIS)
is used for keeping a centralized repository of users, hostnames and other useful
information in a computer network.

Setting up a server:

The packages that are required for setting up a NIS Server are:

          #rpm ­ivh ypserv
          #rpm ­ivh ypbind
          #rpm ­ivh portmap
          #rpm ­ivh yp­tools

To check whether the packages are installed or not:

         #rpm ­q yp*
         Packages yp* are installed
 
Perform the following steps to configure the NIS server:

1. The NIS domain NISDOMAIN="nanacd" needs to be added in the
/etc/sysconfig/network file.

       2. The NIS Server also needs to be set up as a client. Edit the /etc/yp.conf
file and add the following line:
   
            #vi /etc/yp.conf
            ypserver 127.0.0.1

3.start the following daemons : portmap, yppasswdd, ypserv and ypxfrd.

         #service portmap start
        #service yppasswdd start
        #service ypserv start
        #service ypxfrd start

4. We need to make sure these daemons are running before continuing to the next
step. We can use the rpcinfo command to do this:

         # rpcinfo ­p localhost

Initializing The NIS Domain:

      Now that we have decided on the name of the NIS domain, we will have to use the
ypinit command to create the associated authentication files for the domain.

# /usr/lib/yp/ypinit ­m

Start The ypbind and ypxfrd Daemons :

# service ypbind start
#service ypxfrd start

Adding New NIS Users :

Step 1:  Before Adding create a directory rhome in file system
     
            mkdir /rhome

Step 2: Change the permission for rhome

            chmod 777 /rhome

Step3 : Change the nan directory home to rhome

           mv /home/nan /rhome

Step 4: Change the ownership of nan users

          chown nan:user /rhome/nan

        Once this is complete, you then have to update the NIS domain's authentication
files by executing the make command in the /var/yp directory.

          # cd /var/yp
          #make

        You can check to see if the user's authentication information has been updated
by using the ypmatch,getent  command, which should return the user's encrypted password
string.

         # ypmatch nisuser passwd
         # getent passwd nisuser

The steps to configure the NFS for NIS server is: 

Configure the NFS Server for NIS file sharing:

      1. Edit the /etc/exports file to allow NFS mounts of the /home directory with
          read/write access.

        #vi /etc/exports     
       /rhome *(rw,sync)    #Add this statement in the file vi/etc/exports

     2. Let NFS read the /etc/exports file for the new entry, and make /home available to
         the network with the exportfs command.

     #exportfs ­a

    3. Make sure the required nfs, nfslock, and portmap daemons are both running and
        configured to start after the next reboot.

     # service portmap start
     # service nfslock start
     # service nfs start

Configure auto.master using following steps:-

      /etc #vi/auto.master

make an entry something like this

      /rhome  /etc/auto.rhome

Create a gile vi/etc/auto.rhome

       #vi /etc/auto.rhome

      and add the line

       *       -rw,soft,intr   server ip:/rhome/& 

Setting up a client:

The following packages are required for setting up a client:

           #rpm ­ivh ypbind
          #rpm ­ivh yp­tools
          #rpm ­ivh authconfig*


create a dirctory rhome in file system and change the permission 777

Perform the following steps to configure the NIS client:

  Execute the command:
          
             authconfig-tui

This will let you specify the NIS domain and the NIS Server.



Select the [*]Use NIS option and then click Next.




3. Enter the Domain Name : “nanacd” and the Server ip
      192.168.20.167 and then click “ok”
4. Then execute the following commands to restart the ypbind service

                           # chkconfig ypbind on
                           # service ypbind start

To check the client identification:

Use the ypcat command to check the content of your NIS maps. For example:

                         # ypcat passwd

NFS Client Configuration Files for NIS:

     mount:
Any NFS share made available by a server can be mounted using various methods. Of   ourse, the share can be manually mounted, using the mount command, to acquire the  exported filesystem at a particular mount point.
          [root@nis­client]# mount host:remote­path local­path

If user directories from the host 192.168.20.167, for example, should be imported, and
stored in the new directory /home in the client side the following command can be used:

         [root@nisclient]# mount 192.168.20.167:/rhome /rhome

No comments:

Post a Comment