Network Information Service
Network Information Service
Network Information Service
Packages :
For installing NIS the following packages are required.
For server:
ypserv
portmap
make
For client:
ypbind
portmap
authconfig
autofs
Installation:
Step1:
Configure the NISDOMAIN. It should be different from the FQDN [domain name].
[root@vm3 ~]# nisdomainname nis.lap.com
And you have to resolve it in /etc/hosts
Step2:
Security Tip:
To allow only some hosts to access information of NIS, create this file and edit as
follows. [At first time]
Step3:
Step4:
Create Users:
Step5:
# vi /var/yp/Makefile
In this file you can specify MINUID and MINGID [line num 32] and any files you want
to read by NIS. [line num 72]. Read the Comments for details.
If we have only one server, we don't have to push the maps to the slave servers
(NOPUSH=true). If you have slave servers, change this to "NOPUSH=false" and put all
hostnames of your slave servers in the file /var/yp/ypservers.
NOPUSH=false
Running /var/yp/Makefile...
gmake[1]: Entering directory `/var/yp/nis.lap.com'
Updating passwd.byname...
Updating passwd.byuid...
Updating group.byname...
Updating group.bygid...
Updating hosts.byname...
Updating hosts.byaddr...
Updating rpc.byname...
Updating rpc.bynumber...
Updating services.byname...
Updating services.byservicename...
Updating netid.byname...
Updating protocols.bynumber...
Updating protocols.byname...
Updating mail.aliases...
gmake[1]: Leaving directory `/var/yp/nis.lap.com'
You have to share the /home directory of the NIS server machine inorder to access from
the client machines. Because when you are logging in from client you are getting to that
users home directory. So it should be mounted to client machine from the server.
[Implement the proper backup mechanism for /home in the server.]
# make
Install the ypserv, portmapper and dependancy packages. And set the
NISDOMAINNAME same as in the server. In this example. As follows.
Create entries for name resolutions of server and other hosts in /etc/hosts. Its better you
copy the /etc/hosts of server and make proper edits in it.
Where vm3 is the hostname of server and it should be resolved in /etc/hosts. And dont
forget to update the server's /etc/hosts file with slave's information.
If the following command executed well, you will get output as follows.
Transferring netid.byname...
Trying ypxfrd ... success
Transferring group.byname...
Trying ypxfrd ... success
[..output truncated..]
Transferring services.byservicename...
Trying ypxfrd ... success
You might want to edit root's crontab *on the slave* server and add the following lines:
20 * * * * /usr/lib/yp/ypxfr_1perhour
40 6 * * * /usr/lib/yp/ypxfr_1perday
55 6,18 * * * /usr/lib/yp/ypxfr_2perday
This will ensure that most NIS maps are kept up-to-date, even if an update is missed
because the slave was down at the time the update was done on the master.
On the master server, add the new slave server name to /var/yp/ypservers and run
make in /var/yp to update the map .
Give the domain name and Ipof the NIS server in client.
#authconfig -tui
or
#setup
-> Authentication Configuration
->Check these fields
->Cache Information.
->Use NIS
->next
Domain: nis.lap.com #give domain name here its nis.lap.com
Server: 192.168.0.23
If you have slave servers give like this. Ips of machines one after one separated by
commas.
The username and passwords should be checked in order such that the NIS files should
be checked first. So edit the entries as follows.
vi /etc/nsswitch.conf
passwd: nis files
shadow: nis files
group: nis files
Configure autofs:
-rw,sync 192.168.0.23:/home/&
#ypcat passwd
from client executing the above command will give the entriesof NIS users in /etc/passwd
file of master server.