Friday, April 23, 2010

Network Information Services (NIS)

Introduction
To access Linux computer, you would need to have a valid username and password. A common problem that a large network of Lunux computer that normally each user would require an account on every linux computer.
However there is such services offered in Linux that would allow you to setup one central managed database of usernames and password called NIS. NIS only requires you to maintain one password database on the NIS server and configure the other system on the network as clients.

Features of NIS
1.Able to create user accounts that can be shared across all systems on your network.
2.The user account is created only on the NIS server.
3.Users only need to change their passwords on the NIS server only
4.NIS clients are typically limited to Unix or Linux operating systems

Install NIS
There are 3 ways to install NIS on the NIS Server:
1.Install through Yum
2.Install RPM package

Yum (Yellowdog Updater Modified)
Install through yum is simple. Just execute the following command to install
#yum install ypserv ypbind portmap yp-tools

RPM Package Manager
Installing through RPM Package manager requires a bit more work. Normally we will install from the CD/DVD-ROM provided. If in any case a CD/DVD-ROM is not available, we will have to download the rpm file from online source.

a) Navigate to the source, which most like be the CD/DVD-ROM. The source CD/DVD-ROM have to be inserted first.

#cd /media/RHEL_5.3\x86\DVD/server

b) Install RPM
#rpm –ivh ypbind*
#rpm –ivh ypserv*
#rpm –ivh yptools*

Setting up NIS server
•The following steps are performed on the instructor computer
•Log in as root

The following command bring you to the text editor mode of the network config file
#nano /etc/sysconfig/network

Type and follow text into the file and press Crt + X and Y to save and exit from the text editor
NISDOMAIN=”NIS_LINUX_SERVER”

NIS server will have to be configured as NIS Client as well ,so you would also have to edit the NIS Client configuration file too as being the sever itself or as localhost.

#nano /etc/yp.conf

Type and follow text into the file and press Crt + X and Y to save and exit from the text editor
ypserver 127.0.0.1

Start the necessary NIS daemons in the /etc/init.d directory and perform chkconfig commands to ensure they start after
_________________________
#service portmap start
#service yppasswdd start
#service ypserv start
#chkconfig portmap on
#chkconfig yppasswdd on
#chkconfig ypserv on

_________________________

Type the following command to confirm that the above services are running
# rpcinfo -p localhost

Initialize your NIS domain by adding the instructor computer into the NIS server list

# /usr/lib/yp/ypinit –m
#instructor ~ the computer name
#y

OR

#/usr/lib86/yp/ypinit –m
#instructor ~ the computer name
# y

Start the ypbind and ypxfrd Daemons
•You can only perform the following command if your NIS files have already been created

#service ypbind start
#service ypxfrd start
#chkconfig ypbind on
#chkconfig ypxfrd on

Type the following command to confirm that the all NIS daemons are running
# rpcinfo -p localhost

Create NIS users
Create two user account called studentA & studentB. Both the password is password.

#useradd -g users studentA
#passwd password
#password ~ re-entering of passord
# cd /var/yp
#make ~ creating directory for user

#useradd -g users studentB
#passwd password
#password ~ re-entering of passord
# cd /var/yp
#make ~ creating directory for user


Confirm user authentication information has been updated by using the ypmatch or getent command

#ypmatch studentA passwd
#getent passwd studentB


Setting up NIS client
The authconfig-tui command enter into a program that automatically configures the NIS files after prompting you for the IP address and domain of the NIS server. It is the fastest and easiest way of setting up NIS client. * use the tab button to move around the menu.
#authconfig-tui

Once done check the yp.conf file to ensure that the required NIS information has been entered into the files

#nano /etc/yp.config
#nano /etc/sysconfig/network

Troubleshooting Techniques

NIS SERVER
While setting up NIS Server , if you faced any problem during the setup phase. , You would have to delete the /var/yp/NIS_LINUX_SERVER directory and restart portmap , yppasswd,ypserv before you are able to setup again.

#nano /etc/sysconfig/network

Remove the following text from the file and press Crt + X and Y to save and exit from the text editor

NISDOMAIN=”NIS_LINUX_SERVER”

NIS server will have to be configured as NIS Client as well ,so you would also have to edit the NIS Client configuration file too as being the sever itself or as localhost.

#nano /etc/yp.conf

Remove the following text from the file and press Crt + X and Y to save and exit from the text editor

ypserver 127.0.0.1

Restart the necessary NIS daemons in the /etc/init.d directory and perform chkconfig commands to ensure they start after the next reboot

#service portmap restart
#service yppasswdd restart
#service ypserv restart
#chkconfig portmap on
#chkconfig yppasswdd on
#chkconfig ypserv on


Test NIS Access to NIS Server

The following commands allow you to ypcat , ypmatch and getent command from the student computer.

# ypcat passwd
#ypmatch passwd
#getent passwd <>


Test that firewall allow NIS Daemon to pass through.
•Ensure that telnet is enable for Instructor and Student Computer
#telnet
#<>
#


•Using ssh to log into NIS client

#shh –l
#


If for both telnet or shh you are unable to log in then you would have to check on Linux firewall settings.

No comments:

Post a Comment