Chinaunix首页 | 论坛 | 博客
  • 博客访问: 383211
  • 博文数量: 146
  • 博客积分: 7142
  • 博客等级: 少将
  • 技术积分: 975
  • 用 户 组: 普通用户
  • 注册时间: 2009-12-03 09:43
文章分类

全部博文(146)

文章存档

2012年(1)

2011年(5)

2010年(24)

2009年(116)

我的朋友

分类: LINUX

2009-12-15 12:26:07

1.NIS服务器端配置 (server115.example.com--192.168.0.115)
  1.安装相关软件 :yum -y install yp*
  2.打开portmap: service portmap start ; chkconfig portmap on
  3.  #nisdomainname example.com
       #echo“/bin/nisdomainname example.com”>> /etc/rc.d/rc.local
       #echo“NISDOMAIN=example.com”>> /etc/sysconfig/network
 4.vim /etc/hosts 对应好 主机名和IP
 5.编辑主配置文件/etc/ypserv.conf
       在最后加上:
      192.168.0.0/255.255.255.0     : *       : *                : none   //对这个网段的主机验证不加限制
       *                                         : *       : *                : deny   //对其他网段的主机要求一律拒绝
  6.重启一下 ypserv 和yppasswdd服务,并设置开机启动(chkconfig)
  7.制作数据库
 
[root@server115 ~]# /usr/lib/yp/ypinit -m
At this point, we have to construct a list of the hosts which will run NIS
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 .
        next host to add:  server115.example.com
        next host to add:  (这里按Ctrl + D表示结束)
The current list of NIS servers looks like this:
server115.example.com
Is this correct?  [y/n: y]  y
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'
。。。。。。。。。。。。。。。
   8.再重启服务。
 
 
2NIS客户端(station15.example.com--192.168.0.15)
1.安装好软件ypbind,yp-tools.并打开portmap服务。
2.按客户端的步骤设置好nisdomainname和/etc/hosts
3.运行authconfig-tui命令 图形化界面设置
             1>  [*] Use NIS
                  [*] Use MD5 Passwords 
                   [*] Use Shadow Passwords  
               2>
                Domain: example.com          
                Server: server115.example.com
 
 4.vim /etc/nsswitch.conf //设置查询密码程序
               有一栏hosts的
       hosts:      file    nis    dns    //file 为/etc/passwd.   nis就是NIS啦 
           按顺序,会先检查  本地etc/passwd ,若没有,再检查NIS
 
5. 重启ypbind服务。并设为默认启动。
 
3.NIS Client检验NIS
    用yptest命令检查

[root@station15 ~]# yptest
Test 1: domainname
Configured domainname is "example.com"
Test 2: ypbind
Used NIS server: server115.example.com
 
。。。。。。。。。。。。。。。。
Test 9: yp_all
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文件

               1. #vim /etc/fstab
         192.168.0.155:/home    /home         nfs          defaults     0       0
 
                2.#mount -a
 
 
OK!   一个NIS服务器已经设定完毕。
阅读(1163) | 评论(0) | 转发(0) |
0

上一篇:VSFTP配置手册

下一篇:FTP 之传输原理篇

给主人留下些什么吧!~~