NIS 服务器搭建(账号服务器)

#!/bin/bash

#nis software list

#yp-tools search nis

#ypbind nis client

#ypserv nis server

#rpcbind

yum -y install yp-tools ypbind ypserv rpcbind;

#/etc/ypserv.conf /etc/hosts /etc/sysconfig/network /var/yp/Makefile

#sh /usr/lib64/yp/ypinit  /usr/bin/yppasswd

#

设置域名

vim /etc/sysconfig/network

NISDOMAIN=vbirdnis

YPSERV_ARGS="-p 1011"

vim /etc/ypserv.conf

* : * : * : none

vim /etc/hosts

192.168.10.68 centos7test2

192.168.10.159 centos7test4

vim /etc/sysconfig/yppasswdd

YPPASSWDD_ARGS="--port 1012"

/etc/init.d/ypserv start

/etc/init.d/yppasswdd start

chkconfig ypserv on

chkconfig yppasswdd on

#

创建帐号

useradd -u 1001 nisuser1

useradd -u 1002 nisuser2

useradd -u 1003 nisuser3

echo "geeboo"|passwd --stdin nisuser1

echo "geeboo"|passwd --stdin nisuser2

echo "geeboo"|passwd --stdin nisuser3

#init databasse

/usr/lib64/yp/ypinit -m

###############client

yum -y install ypbind yp-tools rpcbind;

vim /etc/sysconfig/network

HOSTNAME=centos7test2

NETWORKING=yes

GATEWAY=192.168.10.1

NISDOMAIN=vbirdnis

vim /etc/yp.conf

domain vbirdnis server 192.168.10.159

vim /etc/nsswitch.conf

passwd: files nis

shadow: files nis

group: files nis

hosts: files nis dns

vim /etc/sysconfig/network

NISDOMAIN=vbirdnis

YPSERV_ARGS="-p 1011"

domainname vbirdnis

service ypbind start;

yptest

############server

ypcat passwd.byname    #/var/yp/vbirdnis/*

#####client

yppasswd  ==  passwd

ypchfn  === chfn

ypchsn  == chsh

你可能感兴趣的:(NIS 服务器搭建(账号服务器))