您的位置:首页 > 其它

Debian下NIS服务器安装配置

2014-12-29 11:09 423 查看
Debian下集群构建之------NIS服务器安装配置

0 网络拓扑
nis server: 192.168.16.2
nis client: 192.163.16.31 服务器端配置
添加测试用户
$ sudo adduser nistest
软件安装
$ sudo aptitude update
$ sudo aptitude install nis portmapNIS 服务的控制启动

$ sudo /etc/init.d/nis start
停止
$ sudo /etc/init.d/nis stop
重启
$ sudo /etc/init.d/nis restart
配置1. 修改配制文件 /etc/defaultdomain 内容如下, 设定 NIS 的域:

nis
2. 执行
$ sudo domainname nis3. 修改配置文件 /etc/default/nis 确保有如下设置, 设定为 NIS 主服务器
NISSERVER=master
NISCLIENT=true4. 重启服务
/etc/init.d/nis restart
Starting NIS services: ypserv yppasswdd ypxfrd ypbind
生成映射文件用户可以使用 make 命令初始化独立服务器,建立NIS映射表,文件 /var/yp/Makefile 包含了创建数据库的命令, 可以通过编辑Makefile指定系统准备分发哪些映射表。比如:
ALL = passwd group hosts rpc services netid protocols netgrp
使用 make 命令初始化独立服务器 $ cd /var/yp
$ sudo make测试使用 ypwhich 命令测试与服务器的连接情况
$ ypwhich
192.168.16.2
安全配制在配置文件 /etc/ypserv.securenets 中,添加可以访问的客户机的ip地址范围,比如允许 192.168.16.0/255.255.255.0 网络段的所有主机访问

255.0.0.0 127.0.0.0
255.255.255.0 192.168.16.0
映射文件的访问控制可以通过修改主配置文件: /etc/ypserv.conf 来设定对映射文件的访问权限.
配置文件的语法/格式

<设置项目>:<值>

<主机名称/IP>:<网段名称>:<数据库类型>:<安全性>

* 主机名称/IP:通常可以这样设置:192.168.16.0/255.255.255.0,表示192.168.16.0/24整个网段;
* 网段名称:通常设置为*即可;
* 数据库类型:可以使用 '*' 来表示所有类型;
* 安全性:主要有三种参数:
o none:可以无条件进入本机;
o port:仅允许1024以下的端口进入;
o deny:不允许其它用户进入本机;
由于这次的目标比较简单, 所以所有参数都使用默认设置:
# Host : Domain : Map : Security
#
# * : * : passwd.byname : port/mangle
# * : * : passwd.byuid : port/mangle

# This is the default - restrict access to the shadow password file,
# allow access to all others.
* : * : shadow.byname : port
* : * : passwd.adjunct.byname : port
* : * : * : none
2 客户端配置
软件安装
$ sudo aptitude update
$ sudo aptitude install nis portmap配置1. 修改配置文件 /etc/default/nis 确保有如下设置,配置为 NIS 客户端

NISSERVER=false
NISCLIENT=true2. 在配置文件 /etc/hosts 中添加 NIS 服务器的记录
192.168.16.2 nisserv3. 修改 /etc/defaultdomain 内容如下, 设定 NIS 域
nis4. 执行命令
$ sudo domainname nis5. 修改配置文件 /etc/yp.conf, 加入如下内容, 指定索要使用的 NIS 服务器
ypserver nisserv
或ypserver 192.168.16.26. 确保配置文件 /etc/nsswitch.conf 中,passwd, group, shadow 和 netgroup 条目如下设置
passwd: compat nis
group: compat nis
shadow: compat nis1. 使用 ypwhich 测试
$ ypwhich
nisserv2. 使用 yptest 测试$ yptest3. 使用 ypcat 测试$ ypcat passwd3 使用
在客户端,使用服务器端的测试用户 nistest 用户登录, 系统从 NIS 服务器获取 nistest 用户的信息, 登录成功:

debian login: nistest
Password:
Linux debian 2.6.18-4-686 #1 SMP Mon Mar 26 17:17:36 UTC 2007 i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
No directory, logging in with HOME=/
nistest@debian:/$参考:http://debian.linuxsir.org/doc/i ... bian.conf.html#toc3 小编有改动!!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  软件 服务器 server