Debian下NIS服务器安装配置

运维 系统运维
本文详细讲了如何在Debian下NIS服务器的安装配置过程。

Debian下集群构建之------NIS服务器安装配置

0    网络拓扑

                   nis server: 192.168.16.2                        nis client: 192.163.16.3
1    服务器端配置

添加测试用户

                   $ sudo adduser nistest
软件安装

                   $ sudo aptitude update                   $ sudo aptitude install nis portmap
NIS 服务的控制
启动

                   $ 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 nis
3. 修改配置文件 /etc/default/nis 确保有如下设置, 设定为 NIS 主服务器

                   NISSERVER=master                   NISCLIENT=true
4. 重启服务

                   /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=falseNISCLIENT=true
2. 在配置文件 /etc/hosts 中添加 NIS 服务器的记录

192.168.16.2 nisserv
3. 修改 /etc/defaultdomain 内容如下, 设定 NIS 域

nis
4. 执行命令

$ sudo domainname nis
5. 修改配置文件 /etc/yp.conf, 加入如下内容, 指定索要使用的 NIS 服务器

ypserver nisserv

ypserver 192.168.16.2
6. 确保配置文件 /etc/nsswitch.conf 中,passwd, group, shadow 和 netgroup 条目如下设置

passwd:                    compatgroup:                     compatshadow:                    compat
7. 在文件 /etc/passwd 尾部加入


+::::::              (6个:)
8. 在文件 /etc/shadow 尾部加入

+::::::::            (8个:)
9. 在文件 /etc/group 尾部加入:

+:::                 (3个:)
客户端测试
1. 使用 ypwhich 测试

$ ypwhichnisserv
2. 使用 yptest 测试
$ yptest
3. 使用 ypcat 测试
$ ypcat passwd
3    使用

在客户端,使用服务器端的测试用户 nistest 用户登录, 系统从 NIS 服务器获取 nistest 用户的信息, 登录成功:

debian login: nistestPassword:Linux debian 2.6.18-4-686 #1 SMP Mon Mar 26 17:17:36 UTC 2007 i686The programs included with the Debian GNU/Linux system are free software;the exact distribution terms for each program are described in theindividual files in /usr/share/doc/*/copyright.Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extentpermitted by applicable law.No directory, logging in with HOME=/nistest@debian:/$

责任编辑:符甲 来源: 51CTO.com
相关推荐

2011-02-23 12:18:28

DebianProFTPd服务器

2015-12-25 14:30:47

LinuxISC DHCP服务器

2009-09-17 16:55:02

WSUS服务器

2009-09-17 18:05:51

Nis服务器

2009-09-17 13:23:22

NIS服务器

2009-09-24 14:58:19

打印服务器

2010-05-18 13:02:30

2009-09-17 18:07:51

Nis服务器

2009-09-17 18:04:42

Nis服务器

2009-03-04 09:48:52

安装配置桌面虚拟化Xendesktop

2009-09-16 16:02:11

2011-03-23 13:29:46

Debian安装Nagios

2009-09-17 16:50:23

WSUS服务器

2009-09-17 18:09:53

Nis服务器

2009-09-11 08:49:09

linuxNIS服务linux配置

2009-03-01 14:40:16

LinuxNF安装

2010-02-03 14:28:15

Linux Samba

2009-09-17 18:02:06

2010-09-14 11:16:55

Debian Linu

2010-05-13 18:18:50

IIS服务器
点赞
收藏

51CTO技术栈公众号