RHEL 5.3 NIS 服务搭建
#1.about NIS
NIS NIS (Network Information Service)网络信息服务,类似于windows AD.简单说就是客户端登陆验证全部都交给NIS服务器来处理。
在 NIS 环境中, 有三种类型的主机:
1.主服务器(master)
2.从服务器(slave)
3.客户机    (client)

#2工作原理

1.server开启后会用portmapper 分配端口给ypserv进程 和 yppasswd进程
2.client登陆验证时client的ypbind进程会去连接server的portmapper
3.server在指定一个port给client
4.client的ypbind用刚刚被指定的port号和ypserv来连线并作验证
5.client修改passwd时,client的yppasswd和server的yppasswd来沟通

#3.服务所需软件包
[root@ns ~]# rpm -qa  yp*
yp-tools-2.9-0.1       
ypbind-1.19-11.el5
ypserv-2.19-5.el5

#portmap不是NIS服务器的包,但NIS和必须依赖他
[root@ns ~]# rpm -qa  portmap
portmap-4.0-65.2.2.1

#################################################################################################
#4.配置NIS服务器

#添加NIS域名
[root@ns ~]# nisdomainname jshlx-nis
[root@ns ~]# echo "NISDOMAIN=jshlx-nis" >> /etc/sysconfig/network

[root@ns ~]# /etc/init.d/ypserv start 
Starting YP server services:                               [  OK  ]
[root@ns ~]# /etc/init.d/yppasswdd start
Starting YP passwd service:                                [  OK  ]

#修改为开机自启动服务
[root@ns ~]# chkconfig ypserv on
[root@ns ~]# chkconfig yppasswdd on

#添加一个普通账号,用于测试,如果有这步就不用了。
[root@ns ~]# useradd simp
[root@ns ~]# passwd simp

[root@ns ~]# /usr/lib/yp/ypinit -m

At this point, we have to construct a list of the hosts which will run NIS
servers.  ns.simp.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:  ns.simp.com
        next host to add: 
The current list of NIS servers looks like this:

ns.simp.com

Is this correct?  [y/n: y]  y
We need a few minutes to build the databases...
Building /var/yp/jshlx-nis/ypservers...
Running /var/yp/Makefile...
gmake[1]: Entering directory `/var/yp/jshlx-nis'
Updating passwd.byname...
Updating passwd.byuid...
Updating group.byname...
Updating group.bygid...
Updating hosts.byname...
Updating hosts.byaddr...
Updating rpc.byname...
Updating rpc.bynumber...
Updating services.byname...
Updating services.byservicename...
Updating netid.byname...
Updating protocols.bynumber...
Updating protocols.byname...
Updating mail.aliases...
gmake[1]: Leaving directory `/var/yp/jshlx-nis'

ns.simp.com has been set up as a NIS master server.

Now you can run ypinit -s ns.simp.com on all slave server.

#将NIS服务器主配置文件的最后一段的#号去了,意为允许所有的主机加入所有的域,安全问题我们稍后解答。
[root@ns ~]# tail -n 2 /etc/ypserv.conf
*                        : *       : *                : none

[root@ns ~]# vi /var/yp/Makefile
找到all: 这一行修改如下:设置共享的范围。
117 all:  passwd group \

#############################################################################################
client 配置

authconfig-tui - (c) 1999-2005 Red Hat, Inc.                                              
            +----------------| Authentication Configuration +-----------------+           
            |                                                                 |           
            |  User Information        Authentication                         |           
            |  [ ] Cache Information   [*] Use MD5 Passwords                  |           
            |  [ ] Use Hesiod          [*] Use Shadow Passwords               |           
            |  [ ] Use LDAP            [ ] Use LDAP Authentication            |           
            |  [*] Use NIS             [ ] Use Kerberos                       |           
            |  [ ] Use Winbind         [ ] Use SMB Authentication             |           
            |                          [ ] Use Winbind Authentication         |           
            |                          [ ] Local authorization is sufficient  |           
            |                                                                 |           
            |            +--------+                      +------+             |           
            |            | Cancel |                      | Next |             |           
            |            +--------+                      +------+             |           
            |                                                                 |           
            |                                                                 |           
            +-----------------------------------------------------------------+           
<Tab>/<Alt-Tab> between elements   |   <Space> selects   |  <F12> next screen        
authconfig-tui - (c) 1999-2005 Red Hat, Inc.                                              
                   +-----------------| NIS Settings +-----------------+                   
                   |                                                  |                   
                   | Domain: jshlx-nis_______________________________ |                   
                   | Server: 192.168.5.3_____________________________ |                   
                   |                                                  |                   
                   |         +------+                 +----+          |                   
                   |         | Back |                 | Ok |          |                   
                   |         +------+                 +----+          |                   
                   |                                                  |                   
                   |                                                  |                   
                   +--------------------------------------------------+                   
<Tab>/<Alt-Tab> between elements   |   <Space> selects   |  <F12> next screen  
Stopping portmap:                                          [  OK  ]
Starting portmap:                                          [  OK  ]
Shutting down NIS services:                                [  OK  ]
Binding to the NIS domain:                                 [  OK  ]
Listening for an NIS domain server..

####################################################################################################
#这时候注销用之前新建的普通账号登录就会出现以下信息。
Last login: Fri Oct  9 17:43:30 2009
No directory /home/simp!                
Logging in with home = "/".
-bash-3.2$

#上面已经登录成功,但是却提示没有家目录,只需要在server端开共享即可
[root@ns ~]# echo "/home 192.168.5.0/24(rw,sync)" &gt;&gt; /etc/exports        
[root@ns ~]# exportfs  -r
[root@ns ~]# showmount -e localhost
Export list for localhost:
/home    192.168.5.0/24

[root@ns ~]# /etc/init.d/nfs start
[root@ns ~]# chkconfig nfs on

#客户端挂载服务器端的/home到本地的/home
[root@ns ~]# mount.nfs 192.168.5.3:/home /home/

#客户端重新登录后,就不在有找不到家目录的提示了
Last login: Fri Oct  9 17:53:34 2009 from 192.168.0.19
[simp@ns ~]$

####################################################################################################
进阶设置
[root@ns ~]# mkdir /nis_home
[root@ns ~]# chmod 1777 /nis_home/
[root@ns ~]# useradd -Db /nis_home/
[root@ns ~]# useradd nis1
[root@ns ~]# passwd nis1
Changing password for user nis1.
New UNIX password:
BAD PASSWORD: it is too simplistic/systematic
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@ns ~]# useradd nis2
[root@ns ~]# passwd nis2
Changing password for user nis2.
New UNIX password:
BAD PASSWORD: it is too simplistic/systematic
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

[root@ns ~]# echo "/nis_home/   192.168.5.0/24(rw,sync)" &gt;&gt; /etc/exports
[root@ns ~]# exportfs -r                                            
[root@ns ~]# showmount -e localhost                                  Export list for localhost:
/nis_home 192.168.5.0/24

[/root]#echo "/nis_home       /etc/auto.home    --timeout=600" &gt;&gt; /etc/auto.master
[/root]#echo "*               -rw,soft,intr           192.168.5.3:/nis_home/&" &gt;&gt; /etc/auto.home

[/etc]#/etc/init.d/autofs restart
[/etc]#su - nis1
[nis1@ns ~]$
[/etc]#mount
/dev/sda1 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
none on /proc/fs/vmblock/mountPoint type vmblock (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
192.168.5.3:/nis_home/nis1 on /nis_home/nis1 type nfs (rw,soft,initr,addr=192.168.5.3)

[root@ns ~]# rpcinfo -p  $hostname
   program vers proto   port
    100000    2   tcp    111  portmapper
    100000    2   udp    111  portmapper
    100024    1   udp    675  status
    100024    1   tcp    678  status
    100004    2   udp    616  ypserv
    100004    1   udp    616  ypserv
    100004    2   tcp    619  ypserv
    100004    1   tcp    619  ypserv
    100009    1   udp    630  yppasswdd
    100011    1   udp    695  rquotad
    100011    2   udp    695  rquotad
    100011    1   tcp    698  rquotad
    100011    2   tcp    698  rquotad
    100003    2   udp   2049  nfs
    100003    3   udp   2049  nfs
    100003    4   udp   2049  nfs
    100021    1   udp  43122  nlockmgr
    100021    3   udp  43122  nlockmgr
    100021    4   udp  43122  nlockmgr
    100003    2   tcp   2049  nfs
    100003    3   tcp   2049  nfs
    100003    4   tcp   2049  nfs
    100021    1   tcp  52450  nlockmgr
    100021    3   tcp  52450  nlockmgr
    100021    4   tcp  52450  nlockmgr
    100005    1   udp    709  mountd
    100005    1   tcp    712  mountd
    100005    2   udp    709  mountd
    100005    2   tcp    712  mountd
    100005    3   udp    709  mountd
    100005    3   tcp    712  mountd

转载于:https://blog.51cto.com/itchen/210666

rhel 5.3 nis 服务器搭建 详细(原创)相关推荐

  1. 2022网络搭建国赛NIS 服务器搭建

    2022国赛NIS 服务器搭建 节点 主机 node1(nis主服务器) 10.100.100.105 node2(nis客户机) 10.100.100.106 1.环境 2.关闭防火墙与selinu ...

  2. 饥荒创建账号服务器,饥荒服务器搭建详细图文教程 饥荒怎么创建服务器

    <饥荒>大家会不会自己搭建服务器呢?今天笔者就为大家带来了饥荒服务器搭建图文教程,非常不错的内容哦,小伙伴们你们会不会呢?想学着搭建服务器的小伙伴下面我们一起来看看吧. 首先安装Don't ...

  3. winserver搭建smtp_WinServerPOPSMTP邮件服务器搭建详细图解教程

    Win2003 Server POP3 SMTP 邮件服务器搭建详细图解教程 很多企业局域网内都架设了邮件服务器,用于进行公文发送和工作交流.但使用专业 的企业邮件系统软件需要大量的资金投入,这对于很 ...

  4. Gitea——私有git服务器搭建详细教程

    本文将从源代码和docker安装两种方式带大家从0-1通过Gitea搭建一个私有git服务器 Gitea--私有git服务器搭建教程 什么是Gitea 一.源代码安装方式 1. 前置环境要求 2. 下 ...

  5. Wow魔兽世界服务器搭建详细教程,魔兽世界服务器配置要求

    自从<魔兽世界>国服关服后,很多魔兽老玩家心里都是空落落的,魔兽陪伴了我们十多年,此次关服犹如关上了通往艾泽拉斯大陆的大门. 上帝关上了一扇门,我们也可以自己开扇窗,随着国服关闭,越来越多 ...

  6. POP3 SMTP邮件服务器搭建详细图解教程1

    POP 即为 Post Office Protocol 的简称,是一种电子邮局传输协议,而 POP3 是它的第三个版本,是规定了怎样将个人计算机连接到 Internet 的邮件服务器和下载电子邮件的电 ...

  7. Linux(ubuntu16.04)FTP服务器搭建详细步骤

    学习linux时遇到了文件传输问题,发现ftp服务器是常用的一种,所以搜集整理了ftp服务器的搭建. 首先介绍一下FTP服务器: FTP 是File Transfer Protocol(文件传输协议) ...

  8. minecraft服务器搭建教程_我的世界游戏服务器搭建详细教程

    Minecraft这是原版英文名称,在中国大陆被译为<我的世界>,这款游戏很火爆.台湾的很多小伙伴也在玩,其译名为<我的创世神>.现在这款游戏在国内已经被网易代理了.因为这款游 ...

  9. LVS 负载均衡服务器搭建(详细)

    转载:http://blog.51cto.com/xuding/1740228 一.LVS概述 1.LVS:Linux Virtual Server 四层交换(路由):根据请求报文的目标IP和目标PO ...

最新文章

  1. 遗传算法解决旅行商问题(TSP)
  2. Ubuntu 安装 scikit-image
  3. DBA(四):数据读写分离,MySQL多实例操作
  4. 对require和import的认识
  5. java 预处理语句_预处理语句PreparedStatement到底咋用啊
  6. 第 45 届国际大学生程序设计竞赛(ICPC)亚洲区域赛(济南):签到题CDGM
  7. 最简单的python爬虫案例,适合入门学习
  8. java对接金蝶webapi
  9. android gc卡顿,由于频繁GC造成的界面卡顿原因分析
  10. 华为云的云计算比阿里云的云计算认证好吗?
  11. PID控制器原理概述
  12. iMazing 2.11.7 WinMac 中文版 — iOS设备管理工具
  13. python是什么意思中文、好学吗-零基础学python难吗?好学吗?
  14. nginx fastcgi_buffers设置
  15. 什么是父子流程,与分合流有什么不同
  16. 《2018中国直销银行白皮书》发布 银行面临“颠覆式创新”
  17. 初学媒体软件时的一些鼠绘作品
  18. redis1:概述、安装测试、基础知识、5大数据类型
  19. 青岛——生命转折的地方
  20. 屏蔽 手机QQ黄钻官方团队总送礼物 的简单方法

热门文章

  1. linux系统ip6tables怎么配置,ip6tables 基本配置
  2. 2019小程序没必要做了_2019年什么行业适合做小程序
  3. c++ 队列_经典数据结构与算法(一):Python/C/C ++实现堆栈和队列
  4. github private链接访问_如何判定一段内存地址是不可访问的?
  5. 计算机网络上机指导,计算机网络上机指导书.pdf
  6. Java 多线程详解(四)------生产者和消费者
  7. 黑苹果 电脑关机是因为发生了问题_【电脑常识】常见的电脑误区,你中了几点?...
  8. animate改变背景颜色_3D MAX2016视口背景设置里各参数的含义详解 - 3dmax基础操作入门教程-3dmax材质教程,3d材质贴图教程参数,vray材质参数,3dmax贴图教程...
  9. Android NDK开发之 与NEON相关的库
  10. Hive日期格式转换