Monday, May 24, 2010

How to configure NIS (Network Information Server) Server in Redhat Linux?

To configure NIS server you have to install ypserve and yp-tools rpms on the server, and ypbind and yp-tools rpms on the client. Follow the below steps to Configure the NIS server.

1) First You need to add the NIS domain you wish to use in the /etc/sysconfig/network file
#/etc/sysconfig/network
NISDOMAIN="MYDOMAIN"

2)NIS servers also have to be NIS clients themselves, so you'll have to edit the NIS client configuration file /etc/yp.conf to list the domain's NIS server as being the server itself or localhost.
Edit your yp.conf file
# /etc/yp.conf - ypbind configuration file
ypserver 127.0.0.1

3)Start the NIS server related Daemons.
service portmap start
service yppasswdd start
service ypserv start

Ensure that the above Daemons are part of the startup

chkconfig portmap on
chkconfig yppasswdd on
chkconfig ypserv on

Client Daemons are

ypbind
portmap
Then run the below command on the server to check the services running

rpcinfo -p localhost

5) Initialize your NIS Domain
Now that you have decided on the name of the NIS domain, you'll have to use the ypinit command to create the associated authentication files for the domain. You will be prompted for the name of the NIS server.

/usr/lib/yp/ypinit -m

You can now start the ypbind and the ypxfrd daemons because the NIS domain files have been created.

service ypbind start
service ypxfrd start

6)Adding NIS users

New NIS users can be created by logging into the NIS server and creating the new user account. In this case, you'll create a user account called nisuser and give it a new password.

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.

This procedure makes all NIS-enabled, nonprivileged accounts become automatically accessible via NIS, not just newly created ones. It also exports all the user's characteristics stored in the /etc/passwd and /etc/group files, such as the login shell, the user's group, and home directory.


useradd -g users nisuser
passwd nisuser
cd /var/yp
make

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

ypmatch nisuser passwd

7) Configuring NIS client.

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

Once finished, it should create an /etc/yp.conf file that defines, amongst other things, the IP address of the NIS server for a particular domain. It also edits the /etc/sysconfig/network file to define the NIS domain to which the NIS client belongs.

n addition, the authconfig program updates the /etc/nsswitch.conf file that lists the order in which certain data sources should be searched for name lookups, such as those in DNS, LDAP, and NIS. Here you can see where NIS entries were added for the important login files.

Start the ypbind NIS client, and portmap daemons in the /etc/init.d directory and use the chkconfig command to ensure they start after the next reboot. Remember to use the rpcinfo command to ensure they are running correctly.

8) Test NIS Access to NIS server.

You can run the ypcat, ypmatch, and getent commands to make sure communication to the server is correct.

Then try logging in via ssh or telnet and test NIS .

No comments:

Post a Comment