Debian 10 Buster
Sponsored Link

NIS : NISサーバーの設定2019/07/29

 
各サーバー間でユーザーのアカウント情報を共有できるように NIS サーバーを構築します。
[1] NIS システムをインストールします。
root@dlp:~#
apt -y install nis
Preconfiguring packages ...
# インストール中、NISドメインの設定を求められるため、自ドメイン名を入力

# インストール後、自動的に起動を試みるが失敗するので、終わるまで待つか、放っておいて別ウィンドウで設定開始する

 +----------------------------| Configuring nis |----------------------------+
 | Please choose the NIS "domainname" for this system. If you want this      |
 | machine to just be a client, you should enter the name of the NIS domain  |
 | you wish to join.                                                         |
 |                                                                           |
 | Alternatively, if this machine is to be a NIS server, you can either      |
 | enter a new NIS "domainname" or the name of an existing NIS domain.       |
 |                                                                           |
 | NIS domain:                                                               |
 |                                                                           |
 | srv.world_____________________________________________________________    |
 |                                                                           |
 |                                  <Ok>                                     |
 |                                                                           |
 +---------------------------------------------------------------------------+
[2] NIS マスターサーバーとして設定します。
root@dlp:~#
vi /etc/default/nis
# 6行目:変更(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
# 最終行:アクセス許可する範囲追記

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:~#
systemctl restart nis
# 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...
make[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...
make[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
関連コンテンツ