Debian 11 Bullseye
Sponsored Link

NIS : サーバーの設定2021/09/06

 
各サーバー間でユーザーのアカウント情報を共有できるように NIS サーバーを構築します。
[1] NIS システムをインストールします。
root@dlp:~#
apt -y install nis
[2] NIS プライマリーサーバーとしての設定をします。
root@dlp:~#
vi /etc/default/nis
# 11行目 : 変更 (NIS プライマリーサーバーとする)

NISSERVER=
master
root@dlp:~#
vi /etc/ypserv.securenets
# This line gives access to everybody. PLEASE ADJUST!
# コメントにする

#0.0.0.0                0.0.0.0
#::/0

# 最終行 : アクセス許可する範囲追記
255.255.255.0   10.0.0.0

root@dlp:~#
vi /etc/hosts
127.0.0.1       localhost
# NIS データベース登録用に自身の IP アドレスを登録

10.0.0.30 dlp.srv.world dlp

root@dlp:~#
vi /etc/defaultdomain
# 新規作成 : ドメイン名を設定

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

root@dlp:~#
systemctl enable rpcbind ypserv yppasswdd ypxfrd
# NIS データベース更新

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 キー
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] NIS サーバーにローカルユーザー/グループ等を新規登録した場合は、以下のようにして NIS データベースへ反映します。
root@dlp:~#
cd /var/yp

root@dlp:/var/yp#
make
関連コンテンツ