Configuring a master NIS Server

1. Check the necessary rpm’s
#rpm –q ypserv yp-tools ypbind

2. Set the NIS Domain name
#nano /etc/sysconfig/network
At the end of file, in a new line, Type
Save(CTRL+O) and exit(CTRL+X) file

3. Set the local loopback ip as the nis server ip to indicate the machine is going to become for NIS server

#nano /etc/yp.conf
At the end of file, in a new line, Type
Save(CTRL+O) and exit(CTRL+X) file

4. Start the necessary NIS server services

• yppasswdd – (NIS Password Service)
service status - #service yppasswdd status
start service - #service yppasswdd start
add startup - #chkconfig yppasswdd on
check - #chkconfig yppasswdd --list

• ypserv – NIS server service(to manage user/ group and NIS domain name)
service status - #service ypserv status
start service - #service ypserv start
add startup - #chkconfig ypserv on

• ypxfrd – NIS map service (To manage user/ group all database)
service status - #service ypxfrd status
start service - #service ypxfrd start
add startup - #chkconfig ypxfrd on

5. Now we have to create a central user and a group maagement database. During the creation you have to give the NIS slave server names one by one (optional)

#/usr/lib/yp/ypinit –m
Give slave server names one by one (if any)
After CTRL + D, press “Y” to enter, the accept the name list.
After edit he slave server list use this file
#nano /var/yp/ypservers

6. Start the NIS client service on the server, so we can join our clients to the domain
#service ypbind start
#chkconfig ypbind on

How to join a client PC to a NIS Domain (Client Side)

7. Delete all local user and group accounts from the clients

• User Accounts
#tail /etc/passwd
#userdel –r username

• Group Account
#tail /etc/group
#groupdel groupname

• Home Folder
#cd /home
#ls –l
#rm –rf homefoldername

8. Join the client to the domain

Select “use NIS
Domain – //NIS Domain Name
Server – //Master Server IP

Creating central user and group accounts on the master server

If there were any user accounts / group account on the master server during the practical they would be automatically converted.

• Add local account first
#useradd uddika
#passwd uddika

#groupadd mygroup

• Convert the above account in to NIS
#cd /var/yp

Now you will be able to login from the client pc’s using the user account. We created on the master server but the client wont to be able to locate the users home folder. To fix the problem do the following.

9. Share the home folders from the master NIS server using NFS service (Network File System)
#service nfs status
#service nfs start
#chkconfig nfs on

To share home folders.

#nano /etc/exports
At the end of file, in a new line, Type
/home *(rw,sync)
Save(CTRL+O) and exit(CTRL+X) file
#service nfs reload
Check – #exportfs –arv

A folder shared using NFS must be access from the other machines by mounting, since it can be to dificult for normal users, to mount their own home folder. We are going to auto mount the home folders to the clients (client side configuration)

#nano /etc/fstab
At the end of file, in a new line, Type /home nfs defaults 0 0
Save(CTRL+O) and exit(CTRL+X) file

How to change your own password as a NIS user


How to change NIS user password as root from the master server
#yppasswd uddika
Root Password ---------------------
New Passwod ----------------------
Retype password -------------------------