The Network Information Service consists of a client-server directory service protocol for distributing system configuration data such as user and host names between computers.
NIS enables you to create user accounts that can be shared across all systems on your network. The description of NIS daemons are given below:
- portmap/rpcbind: The foundation RPC daemon upon which NIS runs.
- yppasswdd: Lets users change their passwords on the NIS server from NIS clients.
- ypserv: Main NIS server daemon.
- ypbind: Main NIS client daemon.
- ypxfrd: Used to speed up the transfer of very large NIS maps
NIS Master Server Configuration
1. Install the NIS server packages.
# yum install yp*
2. Set NIS domain name.
# vi /etc/sysconfig/network NISDOMAIN = [DOMAIN_NAME]
3. Start the key NIS Server related daemons.
# service portmap start # service yppasswdd start # service ypserv start # chkconfig portmap on # chkconfig yppasswdd on # chkconfig ypserv on
4. Start rpcbind server:
# service rpcbind start # chkconfig rpcbind on
5. Make sure services are running.
# rpcinfo -p localhost
Example:-
100004 2 udp 843 ypserv 100004 1 udp 843 ypserv 100004 2 tcp 846 ypserv 100004 1 tcp 846 ypserv 100007 2 udp 859 ypbind 100007 1 udp 859 ypbind 100007 2 tcp 862 ypbind 100007 1 tcp 862 ypbind
6. Initialize NIS database.
# /usr/lib/yp/ypinit -m ### On 64 bit systems run '/usr/lib64/yp/ypinit -m`
Adding New NIS Users
1. New NIS users can be created by logging into the NIS server and creating the new user account.
# useradd -g users nisuser # passwd nisuser
2. Update NIS database.
# make -C /var/yp
3. Enter the following command on the NIS master server to verify that the NIS master server is configured and running NIS:
# /usr/bin/ypwhich
NIS Slave Server Configuration
The Master-Side Configuration
1. Edit /var/yp/Makefile to enable “PUSH” maps to slave server when NIS database was updated.
# vi /var/yp/Makefile NOPUSH=false
2. Edit /etc/yp.conf to refer to own server.
# vi /etc/yp.conf ypserver 127.0.0.1
3. Start ypbind and ypxfrd services.
# service ypbind start # service ypxfrd start # chkconfig ypbind on # chkconfig ypxfrd on
4. Add the slave servers to the master server’s database map by editing /var/yp/ypservers.
# vi /var/yp/ypservers master_hostname slave1_hostname slave2_hostname
5. Run make command to update ypservers map.
# make -C /var/yp
The Slave-Side Configuration
Install yp packages in slave server as well. Make sure the name resolve correctly to master’s hostname/IP address. correct /etc/hosts files on both servers.
1. Set NIS domain name in slave server also.
# vi /etc/sysconfig/network NISDOMAIN = [DOMAIN_NAME]
2. Start the NIS Server.
# service portmap start # service ypserv start # chkconfig portmap on # chkconfig ypserv on
3. Make sure the service is running.
# rpcinfo -p localhost
4. To verify the NIS slave server configuration, enter the following command to check whether the NIS slave server is running:
# /usr/bin/ypwhich
5. Do an initial database download from the master with the ypinit -s command and specifying server bigboy as the master from which the data is to be obtained.
# /usr/lib/yp/ypinit -s### On 64 bit systems run '/usr/lib64/yp/ypinit -s [master's hostname/IP address] We will need a few minutes to copy the data from server. Transferring protocols.byname... Trying ypxfrd ... success Transferring services.byservicename... Trying ypxfrd ... success Transferring passwd.byname... Trying ypxfrd ... success server NIS data base has been set up.
If there were warnings, please figure out what went wrong, and fix it.
NIS Client Configuration
1. Set NIS domain name.
# vi /etc/sysconfig/network NISDOMAIN = [DOMAIN_NAME]
2. Edit /etc/yp.conf file.
# vi /etc/yp.conf ypserver [master's IP Address] ypserver [slave's IP Address]
3. Start portmap(rpcbind) and ypbind services.
# service portmap start # service ypbind start # chkconfig portmap on # chkconfig ypbind on
4. Use the following command to see if the user’s authentication information has been updated.
# ypmatch nisuser passwd
5. Edit /etc/nsswitch.conf.
# vi /etc/nsswitch.conf passwd: files nis [ add "nis" service ] shadow: files nis [ add "nis" service ] group: files nis [ add "nis" service ]
6. The getent command can also be used this command return the data from nsswitch.
# getent passwd nisuser
7. As an alternative solution, you can set the above steps by using authconfig command.
# authconfig --enablenis --nisdomain=[NIS DOMAIN NAME] --nisserver=[master's IP address],[slaves's IP address] --update