Ubuntu 22.04
Sponsored Link

NIS : Configure Server2022/09/09

 
Configure NIS Server in order to share users' accounts in your local networks.
[1] Install NIS System.
root@dlp:~#
apt -y install nis
[2] Configure as a NIS primary Server.
root@dlp:~#
vi /etc/default/nis
# line 11 : change (set NIS as a primary server)

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

# add IP range you allow to bind NIS server from NIS clients
255.255.255.0   10.0.0.0

root@dlp:~#
vi /etc/hosts
127.0.0.1       localhost
# add hosts you'd like to add in NIS database

10.0.0.30 dlp.srv.world dlp
10.0.0.51 node01.srv.world node01

root@dlp:~#
vi /etc/defaultdomain
# create new : set NIS domain name

srv.world
root@dlp:~#
systemctl restart rpcbind ypserv yppasswdd ypxfrd

root@dlp:~#
systemctl enable rpcbind ypserv yppasswdd ypxfrd
# update NIS database

root@dlp:~#
/usr/lib/yp/ypinit -m
At this point, we have to construct a list of the hosts which will run NIS
servers.  dlp.srv.world 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.srv.world
        next host to add:  # Ctrl + D key
The current list of NIS servers looks like this:

dlp.srv.world

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...
gmake[1]: Entering directory '/var/yp/srv.world'
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 netgroup...
Updating netgroup.byhost...
Updating netgroup.byuser...
Updating shadow.byname...
gmake[1]: Leaving directory '/var/yp/srv.world'

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

Now you can run ypinit -s dlp.srv.world on all slave server.
[3] If you added users in local server, apply them to NIS database, too.
root@dlp:~#
cd /var/yp

root@dlp:/var/yp#
make
Matched Content