zoukankan      html  css  js  c++  java
  • nis服务器实现用户帐号管理同步

    配置NIS服务器,在server端操作可以使所有client端的用户帐号同步

    测试为两台centos7,server端192.168.52.137     client端192.168.52.140

    前置条件:

    关闭防火墙

    关闭selinux

    配置nis server端

    1、安装需要的软件包:

    yum -y install ypserv rpcbind

    2、设置nis域名:

    [root@spgpu ~]# ypdomainname   srv.world
    [root@spgpu ~]# echo "NISDOMAIN=srv.world" >> /etc/sysconfig/network

    3、添加允许访问NIS服务器的IP地址

     根据自己的环境添加

    [root@spgpu ~]# cat /var/yp/securenets
    255.255.255.0  192.168.52.0         

    255.0.0.0 127.0.0.0       

    4、添加服务和客户端解析:

    ip地址      主机名和域名的结合       主机名

     5、启动相关服务并设置成开机自启:

    [root@spgpu ~]# systemctl start rpcbind ypserv ypxfrd yppasswdd
    [root@spgpu ~]# systemctl enable rpcbind ypserv ypxfrd yppasswdd

    6、更新nis数据库:

    [root@spgpu ~]# /usr/lib64/yp/ypinit -m

    At this point, we have to construct a list of the hosts which will run NIS
    servers. spgpu.srv.world 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>.      这里输入:Ctrl + D
    next host to add: spgpu.srv.world
    next host to add:
    The current list of NIS servers looks like this:

    spgpu.srv.world

    Is this correct? [y/n: y] y     这里输入:y
    We need a few minutes to build the databases...
    Building /var/yp/srv.world/ypservers...
    Running /var/yp/Makefile...
    gmake[1]: Entering directory `/var/yp/srv.world'
    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/srv.world'

    spgpu.srv.world has been set up as a NIS master server.

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

    7、检测server服务是否正常:

    rpcinfo -u 主机名 ypserv

    [root@spgpu ~]# rpcinfo -u spgpu ypserv
    program 100004 version 1 ready and waiting
    program 100004 version 2 ready and waiting

    配置nis客户端

    1、安装相关的软件包:

    [root@spgpu01 ~]# yum -y install ypbind rpcbind

    2、设置nis域名:

    [root@spgpu01 ~]# ypdomainname   srv.world
    [root@spgpu01 ~]# echo "NISDOMAIN=srv.world" >> /etc/sysconfig/network

    3、添加服务和客户端解析

    ip地址      主机名和域名的结合       主机名

    4、更新nis服务器:

    authconfig
    --enablenis
    --nisdomain=srv.world
    --nisserver=spgpu.srv.world      这里填写 nis  server域名
    --enablemkhomedir
    --update

    5、启动相关服务并设置成开机自启:

    [root@spgpu01 ~]# systemctl start rpcbind ypbind
    [root@spgpu01 ~]# systemctl enable rpcbind ypbind

    到此client端设置完成!

    在server端创建用户,修改用户密码之后需要执行一个命令才可以同步到所有的客户端下

    make -C /var/yp

    因为没做home目录共享!client不会自动创建用户家目录,但是用户是已经同步创建好了。

    所以需要在client端需要su -用户   才会创建用户的家目录!

    可以通nfs共享server的home目录到client端这样自动创建家目录。

    在client也可以修改server端创建用户的密码:yppasswd  用户名

    [root@spgpu01 ~]# yppasswd qwer
    Changing NIS account information for qwer on spgpu.szsp.cn.
    Please enter root password:                          这里输入本机的root密码
    Changing NIS password for qwer on spgpu.szsp.cn.
    Please enter new password:
    Please retype new password:

    The NIS password has been changed on spgpu.szsp.cn.

    少年笔尖纯文字,夏末微凉纯薄衫
  • 相关阅读:
    理解MySQL——索引与优化
    Android中shape的使用
    Android之Camera控制拍照
    android的fragments管理
    android的fragment基本介绍
    android的animator
    android软键盘弹出隐藏的监听
    android平板Home键的监听
    android jsonarray
    android 应用静默自启动的解决方法
  • 原文地址:https://www.cnblogs.com/litengfeideboke/p/11731651.html
Copyright © 2011-2022 走看看