NIS集中用户管理linux
前言:NIS简介vim
NIS即网络信息系统(Network Information Service),是对主机账号等系统信息提供集中管理的网络服务。用户登陆任何一台NIS客户机都会从NIS服务器进行登陆认证,可实现用户账号的集中管理。NIS服务器是一个安全的防御,它是对linux系统中的帐户在登陆是进行密码验证。安全
一.NIS服务器的搭建bash
(1)编写批量建立NIS用户脚本服务器
[root@tx1 ~]# vim tx.sh网络
#!/bin/bashdom
mkdir /rhomeide
for i in `seq 1 10`spa
dorest
useradd -d /rhome/nisuser$i nisuser$i
echo nisuser$i | passwd nisuser$i --stdin
done
[root@tx1 ~]# chmod +x tx.sh
[root@tx1 ~]# ./tx.sh
Changing password for user nisuser1.
passwd: all authentication tokens updated successfully.
Changing password for user nisuser2.
passwd: all authentication tokens updated successfully.
(2)配置安装NIS服务
@1.装包
[root@tx1 ~]# yum install ypserv -y
[root@tx1 ~]# vim /etc/sysconfig/network
NISDOMAIN=test
[root@tx1 ~]# /usr/lib/yp/ypinit -m
[root@tx1 ~]# service ypserv start
Setting NIS domain name test: [ OK ]
Starting YP server services: [ OK ]
[root@tx1 ~]# chkconfig ypserv on
@2.将NIS用户的家目录经过NFS共享
[root@tx1 ~]# vim /etc/exports
/rhome *(rw,sync)
[root@tx1 ~]# service nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
[root@tx1 ~]# chkconfig nfs on
(3)客户端配置
@1.启动NIS方式验证
Setup
[root@tx2 ~]# vim /etc/auto.master
/rhome /etc/auto.nis
[root@tx2 ~]# mkdir /rhome
[root@tx2 ~]# cp /etc/auto.misc /etc/auto.nis
[root@tx2 ~]# vim /etc/auto.nis
* -rw,soft,intr 192.168.8.70:/rhome/&
[root@tx2 ~]# service autofs restart
Stopping automount: [ OK ]
Starting automount: [ OK ]
[root@tx2 ~]# chkconfig autofs on
[root@tx2 ~]# su - nisuser1
[nisuser1@tx2 ~]$ //切换用户,验证配置成功