
In this tutorial we are going to create an NIS server so that we create user accounts only on one machine (on NIS Server), and using those user accounts, we logon on any of the NIS Client Machine.
Other benefit of using NIS Server is that, when any nis-user (such as
nisuser1 in this tutorial) works on any NIS Client machine and
create/save/copy their files/folders in their home folder, it is not
stored on their local machine (client) hard-disk but on NIS Server
hard-disk.
Note:
1. We must have enough disk space on NIS Server.
2. NIS doesn't encrypt the password transaction.
In this scenario:
For Server:
Computer Name = nissrv
IP Address = 10.0.0.211
NIS Domain Name=WTUTO
For Client:
Computer Name = client1
IP Address = 10.0.0.212
Configuration on Server:
1. We will install and configure NFS Server to share /home folder of nissrv.
1a. Install required package for nfs server:
[root@nissrv ~]# yum install nfs-utils
1b. Edit the /etc/exports file to allow NFS mounts of the /home directory with read/write access.
[root@nissrv ~]# vim /etc/exports
#make following entries in this file#
/home *(rw,sync)
1.c Edit the /etc/sysconfig/nfs file to define static port numbers:
[root@nissrv ~]# vim /etc/sysconfig/nfs
#make following entries in this file#
MOUNTD_PORT="4002"
STATD_PORT="4003"
LOCKD_TCPPORT="4004"
LOCKD_UDPPORT="4004"
/etc/init.d/nfs start
/etc/init.d/portmap restart
/etc/init.d/nfslock restart
1.e Set following services to automatically start at boot time:
chkconfig nfs on
chkconfig portmap on
chkconfig nfslock on
1.f show the exported folder:
[root@nissrv ~]# exportfs -avf
2. Install and configure NIS Server:2a. Install packages required (ypserv, ypbind, yp-tools) for NIS Server.
[root@nissrv ~]# yum install ypserv ypbind yp-tools
2b. Edit /etc/sysconfig/network to add following entry:[root@nissrv ~]# vim /etc/sysconfig/network
HOSTNAME=srv1
NISDOMAIN="WTUTO"
2.c. Start following services:
[root@nissrv ~]# service ypserv start
[root@nissrv ~]# service yppasswdd start
[root@nissrv ~]# service portmap restart
2d. Set following services to automatically start at boot time:
[root@nissrv ~]# chkconfig ypserv on
[root@nissrv ~]# chkconfig yppasswdd on
[root@nissrv ~]# chkconfig ypxfrd on
2e. Type following command:
[root@nissrv ~]# /usr/lib/yp/ypinit -m
#It will ask u next host to add#
Press CTR+D#
you will get below message #
The current list of NIS servers looks like this:
svr1
Is this correct? [y/n: y]
#
#Press Y#
[root@nissrv ~]# useradd nisuser1
[root@nissrv ~]# passwd nisuser1
Note: If your NIS Server is already running, and you create new user, then you have to update the NIS domain's authentication files by executing the make command in the /var/yp directory. For this take following steps:
[root@nissrv ~]# cd /var/yp
[root@nissrv yp]# ls
binding Makefile nicknames WTUTO ypservers
[root@nissrv yp]# make
gmake[1]: Entering directory `/var/yp/WTUTO'
Updating passwd.byname...
Updating passwd.byuid...
Updating group.byname...
Updating group.bygid...
Updating netid.byname...
gmake[1]: Leaving directory `/var/yp/WTUTO'
[root@nissrv yp]#
Stop iptables service:
[root@nissrv ~]# service iptables stop
[root@nissrv ~]# chkconfig iptables off
Client Side:
Now configure auto.misc and auto.master on client machine:
1. Make following entry in /etc/auto.misc
2. Make following entry in /etc/auto.master
3. Start autofs service and set it to automatically start at boot time.
[root@nissrv ~]# service autofs start
[root@nissrv ~]# chkconfig autofs on
4. Now run authconfig-tui
Select NIS domain
Put WTUTO in domain field
Server's ipaddress in server field
Now login with user nisuser1 from client machine in cmd prompt.





