Setup and configure NIS on Redhat

This entry was posted in Networking, Unix, Windows and tagged on June 17, 2012, by

Network Information Services (NIS) enables you to create user accounts that can be shared across all systems on your network. The user account is created only on the NIS server. NIS clients download the necessary username and password data from the NIS server to verify each user login.The advantage is that user needs to change the password on NIS server only.

1. First create the nfs server

Edit /etc/exports file to share /home directory

# vi /etc/exports

/home   *(rw,sync)

save and quit

Start the nfs services

# ckhconfig nfs on

# chkconfig portmap on

# chkconfig nfslock on

# service nfs start

# service portmap start

# service nfslock start

Configure the client

# chkconfig nfslock on

# chkconfig netfs on

# chkconfig portmap on

# service nfslock start

# service netfs start

# service portmap start

Make a directory home

# mkdir /home

Mount the server directory to it

# mount IP-ADDRESS-OF-SERVER:/home /home

# cd /home; ls -l

You will see the contents of server’s home directory.

Configure the NIS server

You first need to give teh domainname

# vi /etc/sysconfig/network

NISDOMAIN= lab.com

Edit the NIS client configuration file

# vi /etc/yp.conf

ypserver 127.0.0.1

Start the NIS demons

# service ypserv start

# service yppasswdd start

# service portmap start

Look for all demons are running

# rpcinfo -p localhost

Initiliaze your domain

# /usr/lib/yp/ypinit -m

next host to add: Name of the server host

Conrtol D

Press y

Start the ypbind and ypxfrd demons

# service ypbind start

# service ypxfrd start

Make sure demons are running

# rpcinfo -p localhost

Add new NIS user and update the NIs domain authentication file in /var/yp directory

# useradd -g users nisuser

# passwd nisuser

# cd /var/yp

# make

This will update the NIS domain

Check for the password

# ypmatch nisuser passwd

It will display the passowrd, user home directroy ,shell,etc.

Now the NIS server is configured,next step is to configure NIS client

Configure NIS Client

The autoconfig-tui program automatically configures your NIS files after prompting you for the IP address and domain of the NIS server.

# autoconfig-tui

Once finish it will create /etc/yp.conf and edit /etc/sysconfig/network file

# more /etc/yp.conf

Domainname and server name

# more /etc/sysconfig/network

domainname

Start NIS clients related demons

# service portmap start

# service ypbind start

# chkconfig portmap on

# chkconfig ypbind on

Communicate to the server

# ypcat nisuser passwd

# ypmatch nisuser passwd

Now try to login as nis user you will able to login to user’s home directory.

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright 2017 ©Aceadmins. All rights reserved.