客戶端的使用 是重點 (基本理解 是 服務器端配置好的 用戶,可以在任意 NIS客戶端登陸。)
一、服務端:
1。需要安裝包:
ypserv ypbind yptools
2。設置
/etc/sysconfig.network
加
NISDOMAIN=nis.rhce (nis.rhce這個域名自己定義,是客戶端 需要知道的名字)
3。domainname nis.rhce 設置NISdomain
注意區別 :
dnsdomainname=hostname -d, domainname=hostname -y
我們常用的FQDN設置 是用:
dnsdomainname
4。修改/var/yp/Makefile(都是ypserv中的文件)
修改
all: passwd group hosts rpc services netid protocols mail \
為
all: passwd group \
應該是只對密碼 做驗證
5。打開服務
service portmap start
service ypserv start
6.確保make包安裝
7。使用ypinit 產生NIS數據庫(maps)
/usr/lib/yp/ypinit -m
At this point, we have to construct a list of the hosts which will run NIS
servers. student1.com 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: student1.com
next host to add:
The current list of NIS servers looks like this:
student1.com
Is this correct? [y/n: y] y
We need a few minutes to build the databases...
Building /var/yp/nis.rhce/ypservers...
Running /var/yp/Makefile...
gmake[1]: Entering directory `/var/yp/nis.rhce'
Updating passwd.byname...
Updating passwd.byuid...
Updating group.byname...
Updating group.bygid...
gmake[1]: Leaving directory `/var/yp/nis.rhce'
student1.com has been set up as a NIS master server.
Now you can run ypinit -s student1.com on all slave server.
8。啟動NIS password升級進程 對密碼等修改的內容升級
service yppasswdd start
9.重新啟動ypserv
10。確認ypserv服務運行
二、客戶端
1.確認安裝portmap yptools yp-bind包和authconfig包
2。確認客戶端可以看到 服務端的 portmap服務
rpcinfo -p NIS服務器
3。使用 authconfig工具配置 你的客戶端 做 NIS身份驗證
選定
USE NIS 在“DOMAIN:”后 輸入 指定的NIS域(如nis.rhce),SERVER上 輸入指定的NIS服務器
4.authconfig 完成后會自動 開啟ypbind服務,查看 /var/log/message是否 有錯誤出現
5。這里需要注意的是:
只有在服務器上/etc/passwd文件中UID>=500的用戶才能做 NIS的用戶。
當客戶端 和服務端 同名的用戶 以客戶端自己的 用戶密碼登陸,客戶端 沒有 服務端有的,不能在建立和服務端同名的用戶 會報用戶已經存在 錯誤,只有關閉 ypbind才能創建。
用ypcat passwd可以看到 哪些用戶 是NIS驗證服務的用戶
6。如果服務端 新增加 或者 修改了密碼 ,需要到/var/yp/下執行make重新 生成 用戶文件信息。
7。NIS只提供 驗證,不提供文件共享機制。
(文件如果需要共享 可以用到NFS和autofs 具體可以參照第二本書label4)