プログラミングとかLinuxとかの備忘録

プログラミング、Linuxでハマった箇所や環境構築のメモ

Ubuntu16.04をNISクライアントにする

スポンサーリンク

NISサーバ

CentOS7にNISサーバ,クライアントをインストールする
でセットアップしたNISサーバを使用する

インストール

$ sudo apt-get -y install nis
...
Setting up nis (3.17-34ubuntu3) ...   # ここで,ある程度時間がかかった

設定

$ sudo vim /etc/hosts
NISサーバIP  NISサーバ名

$ sudo vim /etc/yp.conf
domain ドメイン名 server サーバ名

nsswhitch.confの編集

$ sudo vim /etc/nsswitch.conf   # 以下の行にnisを追加する
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

passwd:         compat nis
group:          compat nis
shadow:         compat nis
gshadow:        files

hosts:          files mdns4_minimal [NOTFOUND=return] dns nis
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis

ログイン時にホームディレクトリがなければ,自動生成するようにする設定を最終行に追加

$ sudo vi /etc/pam.d/common-session
session optional        pam_mkhomedir.so skel=/etc/skel umask=077

サービス起動

$ sudo systemctl start nis
$ sudo systemctl enable nis

これでだけでは,yptestの結果が以下の様になり,ypbindと通信できなかったので

$ yptest
Test 1: domainname
Configured domainname is "ドメイン名"

Test 2: ypbind
Can't communicate with ypbind

[SOLVED] (K)ubuntu 16.04 NIS client does not work after installingに書いてある通りに,以下のコマンドを実行すると正常に動いた

$ sudo systemctl add-wants multi-user.target rpcbind.service

References