Chinaunix首页 | 论坛 | 博客
  • 博客访问: 480139
  • 博文数量: 82
  • 博客积分: 3003
  • 博客等级: 中校
  • 技术积分: 1285
  • 用 户 组: 普通用户
  • 注册时间: 2007-09-11 15:27
文章分类

全部博文(82)

文章存档

2011年(1)

2010年(5)

2009年(63)

2008年(13)

我的朋友

分类: LINUX

2009-11-30 10:17:42

Network Information Service

1、一种用于集中管理网络中通用配置文件的分布式数据库;

2、典型的基于RPC的服务;

RPC服务的原理和特点:

– RPC Remote Procedure Call(远程进程间通讯)

跨操作系统平台;

依赖于TCP以及应用程序本身解决传输问题;

每个RPC服务会提供类似于端口号的程序号用于远程主机识别和

定位服务;

– RPC程序启动时会通过portmap服务将程序注册到未使用端口;

客户端通过portmap定位RPC服务端口并进行通讯;

默认使用明文传输信息;

– portmap默认使用tcp/udp 111端口提供服务

3、由服务器、客户端和一些管理工具构成

NIS服务相关的软件包、文件以及工具:

软件包:

服务器端:ypserv-.arch.rpm

客户端:ypbind-.arch.rpm

进程:

– ypserv——服务器端守护进程

– ypbind——客户端守护进程

– yppasswdd——密码管理守护进程

配置文件:

– /var/yp/Makefile: map文件生成规则

– /var/yp/securenets: NIS客户机访问控制

– /etc/ypserv.conf: NIS map文件访问规则

– /var/yp: map文件目录

– /etc/ypbind.conf:设置NIS服务器信息

– /etc/nsswitch.conf:系统NSS配置信息

NIS server的理解

如果有一台Linux,它用来专门管理帐号与密码的,而其他的Linux主机当有客户端要登入的时候,就必须要到这部管理密码的主机来查寻使用者的帐号与密码,如此一来,要管理所有的Linux主机的帐号与密码,只要到NIS server上去进行设定就可以了。


简单理解

如果你有一个电话簿,你要查某人的电话号码的时候,直接去查上面的记录来取得电话号码。NIS和它相类似,当使用者要登入时,系统就会到NIS server上去找寻这个帐号与密码信息,以提供使用者登入的验证。


NIS提供的功能

当你运行 #/var/lib/yp/ypinit -m 的时候你会获得如下信息:

At this point, we have to construct a list of the hosts which will run NIS

servers. 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:

next host to add:

The current list of NIS servers looks like this:

Is this correct? [y/n: y] y

We need a few minutes to build the databases...

Building /var/yp//ypservers...

gethostbyname(): Success

Running /var/yp/Makefile...

gmake[1]: Entering directory `/var/yp/'

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/'

has been set up as a NIS master server.

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

注意一下红色标识的部分,你肯定想起来了Linux系统中的下列文件

/etc/passwd

提供使用者帐号、密码(X)UIDGID、注释、家目录所在、登录Shell

/etc/group

提供群组名称以及 GID,还有该群组人员

/etc/hosts

主机名称与IP的对应,常用于 private IP 的主机名称对应

/etc/services

每一种服务所对应的端口 (port number)

/etc/protocols

基础的TCP/IP协议,如 TCP, UDP, ICMP

/etc/netgroup (不熟悉其应用)

网络群组的定义与使用

/etc/rpc

每种 RPC 服务器所对应的程序号码

/var/yp/ypservers

我的/var/yp/ypservers的内容:

localhost.localdomain

NISDOMAIN=

常用工具

rpcinfo 确保portmap服务工作正常

nisdomainname 确保nis服务基本信息正常

ypcat 确保nis输出map文件正常

ypwhich 确保nis客户端和服务器通讯正常

authconfig 配置nis基本信息。(没用过)

rpcinfo

用法:

rpcinfo [ -n 端口号 ] -u 主机名 程序号 [ 版本号 ]

rpcinfo [ -n 端口号 ] -t 主机 程序号 [ 版本号 ]

rpcinfo -p [ 主机 ]

rpcinfo -b 程序号 版本号

rpcinfo -d 程序号 版本号

# rpcinfo -p

程序 版本 协议 端口

100000 2 tcp 111 portmapper

100000 2 udp 111 portmapper

100024 1 udp 830 status

100024 1 tcp 833 status

# rpcinfo -p localhost

程序 版本 协议 端口

100000 2 tcp 111 portmapper

100000 2 udp 111 portmapper

100024 1 udp 830 status

100024 1 tcp 833 status

编辑/etc/sysconfig/network

添加YPSERV_ARGS=”-p 808”更改端口

查看/etc/init.d/ypserv脚本就知道如何设置参数了。

# rpcinfo -p localhost

程序 版本 协议 端口

100000 2 tcp 111 portmapper

100000 2 udp 111 portmapper

100024 1 udp 757 status

100024 1 tcp 760 status

100004 2 udp 808 ypserv

100004 1 udp 808 ypserv

100004 2 tcp 808 ypserv

100004 1 tcp 808 ypserv

nisdomainname

#nisdomainname

ypwhich

#ypwhich

172.16.100.130

ypcat

#ypcat passwd

luck:$1$S9RIE.oG$vP090eHg8MbJFGybSWAQZ.:501:501::/home/luck:/bin/bash

luck4:$1$.OjkEfTB$9zllJLqDNSoueTRcEKjMS.:500:500::/home/luck4:/bin/bash

/var/yp/Makefile中有如下信息,这就是为什么ypcat passwd为什么只看到UID500以上的用户信息。

# We do not put password entries with lower UIDs (the root and system

# entries) in the NIS password database, for security. MINUID is the

# lowest uid that will be included in the password maps. If you

# create shadow maps, the UserID for a shadow entry is taken from

# the passwd file. If no entry is found, this shadow entry is

# ignored.

# MINGID is the lowest gid that will be included in the group maps.

MINUID=500

MINGID=500

阅读(1958) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~