LINUX NIS 服务器简易配置

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 <control D>.
        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服务器已经设定完毕。
 
                                                                           东莞理工城市学院-何文峰
                                                                                2009.04.20 晚
 

 
 
 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在Linux配置NIS(Network Information Service),请按照以下步骤进行操作: 1. 安装 NIS 服务器软件: ```shell sudo apt install ypserv ``` 2. 配置 NIS 服务器: - 编辑 `/etc/default/nis` 文件,并确保 `NISSERVER` 变量设置为 `true`: ```shell sudo nano /etc/default/nis ``` ```plaintext NISSERVER=true ``` - 编辑 `/etc/ypserv.securenets` 文件,指定允许访问 NIS 服务器的子网段。例如,允许本地子网访问: ```shell sudo nano /etc/ypserv.securenets ``` ```plaintext 255.255.255.0 192.168.0.0 ``` 3. 配置 NIS 客户端: - 编辑 `/etc/yp.conf` 文件,添加 NIS 服务器的 IP 地址或主机名: ```shell sudo nano /etc/yp.conf ``` ```plaintext domain your_domain_name server your_server_ip_or_hostname ``` - 编辑 `/etc/nsswitch.conf` 文件,将相应的数据库切换到 NIS。例如,将 passwd 和 shadow 切换到 NIS: ```shell sudo nano /etc/nsswitch.conf ``` ```plaintext passwd: nis [NOTFOUND=return] files shadow: nis [NOTFOUND=return] files ``` 4. 启动 NIS 服务: ```shell sudo service ypserv start ``` 5. 设置 NIS 客户端: ```shell sudo ypbind -broadcast ``` 6. 检查 NIS 配置: - 检查 NIS 服务器是否正在运行: ```shell sudo service ypserv status ``` - 检查 NIS 客户端是否已成功绑定到 NIS 服务器: ```shell ypwhich ``` - 检查 NIS 数据库是否可用: ```shell ypcat passwd ``` 配置完成后,您的 Linux 系统将使用 NIS 来获取用户和组信息。请根据您的网络环境和需求进行适当的配置

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值