Ubuntu 12.04
Sponsored Link

Configure NIS Server2012/05/07

 
Configure NIS server in order to share users' accounts in local network.
[1] Install NIS system
root@dlp:~#
aptitude -y install nis
Preconfiguring packages ...
# input domain name

# Autostart NIS in installation will be fail because configuration is none yet, so wait for a moment to finish it.


[2] Configure NIS Server
root@dlp:~#
vi /etc/default/nis
# line 6: change (set NIS master server)

NISSERVER=
master
root@dlp:~#
vi /etc/ypserv.securenets
# This line gives access to everybody. PLEASE ADJUST!
# make it comment

#
0.0.0.0 0.0.0.0
# add at the last: IP address you allow

255.255.255.0           10.0.0.0

root@dlp:~#
vi /var/yp/Makefile
# line 119: add

ALL = passwd
shadow
group hosts rpc services netid protocols netgrp
root@dlp:~#
vi /etc/hosts
127.0.0.1       localhost
127.0.1.1       dlp
# add own IP address for NIS database

10.0.0.30       dlp

root@dlp:~#
/usr/lib/yp/ypinit -m
# update NIS database
At this point, we have to construct a list of the hosts which will run NIS
servers.  dlp is in the list of NIS server hosts.  Please continue to add
the names for the other hosts, one per line.  When you are done with the
list, type a <control D>.
        next host to add:  dlp
        next host to add:
# push Ctrl+D

The current list of NIS servers looks like this:

dlp

Is this correct? [y/n: y]
y

We need a few minutes to build the databases...
Building /var/yp/srv.world/ypservers...
Running /var/yp/Makefile...
make[1]: Entering directory `/var/yp/srv.world'
Updating passwd.byname...
Updating passwd.byuid...
Updating shadow.byname...
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 netgroup...
Updating netgroup.byhost...
Updating netgroup.byuser...
make[1]: Leaving directory `/var/yp/srv.world'

drv.srv.world has been set up as a NIS master server.

Now you can run ypinit -s drv.srv.world on all slave server.

root@dlp:~#
service ypserv start

ypserv start/running, process 1972
root@dlp:~#
sysv-rc-conf ypserv on
# It's neccessary to update NIS database with following way if new user is added again

root@dlp:~#
cd /var/yp

root@dlp:/var/yp#
Matched Content