* : * : * : deny //对其他网段的主机要求一律拒绝
6.重启一下 ypserv 和yppasswdd服务,并设置开机启动(chkconfig)
servers. server115.example.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: server115.example.com
next host to add: (这里按Ctrl + D表示结束)
The current list of NIS servers looks like this:
We need a few minutes to build the databases...
Building /var/yp/example.com/ypservers...
Running /var/yp/Makefile...
gmake[1]: Entering directory `/var/yp/example.com'
。。。。。。。。。。。。。。。
Server: server115.example.com
[root@station15 ~]# yptest
Test 1: domainname
Configured domainname is "example.com"
Used NIS server: server115.example.com
karl karl:!!:501:501::/home/karl:/sbin/nologin
jen jen:!!:504:504::/home/jen:/sbin/nologin
nisuser nisuser:$1$AaWlFasl$.fYR.cqYag4FbrsFMzzZJ1:505:505::/home/nisuser:/bin/bash
joe joe:xLUGpcUXg3I0I:502:502::/home/joe:/sbin/nologin
mary mary:!!:503:503::/home/mary:/sbin/nologin
feng feng:$1$V./7Fipg$YQjsU3I6W6U19wplibukt0:500:500:feng:/home/feng:/bin/bash
1 tests failed
一个错误可以忽略 连接成功。
4.管理NIS账号
首先,在yptest最后一个测试的一组账号都是可以用NIS登陆的,而他们的初始密码是在服务器端设置好的(/etc/passwd)...若过管理员给你其中一个账号的密码。你就可以 在Client端里用yppasswd更改密码。
[root@station15 ~]# yppasswd joe
Changing NIS account information for joe on server115.example.com.
Please enter root password:
Changing NIS password for joe on server115.example.com.
Please enter new password:
Please retype new password:
The NIS password has been changed on server115.example.com.
5.NIS和NFS结合使用
因为只用nis账号登陆 。原本Client端的/home目录却没有nis账号的文件夹 。为了解决这个问题,我们决定用NFS把服务器端的/home目录直接挂载过来
在服务器端的NFS设置:
1.#vim /etc/exports ----加上 /home 192.168.0.0/24(rw,sync,no_root_squash)
2.#service nfs start; chkconfig nfs on
客户端挂载NFS文件