Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build and configure nis domain service in Centos8

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article is about how Centos8 builds and configures nis domain services. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Introduction to NIS

NIS, the English full name is network information service, also known as yellow pages. In Linux, NIS is a RPC-based client/server system that requires RPC services.

RPC is Remote Procedure Call Protocol (remote procedure call Protocol), and RPCBIND is used to replace the portmap component in the previous version. To put it simply, the purpose of RPCBIND is to bind different services to corresponding ports in order to support the interoperation between machines.

Network environment: node host node1 (nis master server) 192.168.10.222node2 (nis client) 192.168.10.2231. Environment preparation (both nodes)

Turn off the firewall

Systemctl stop firewalld setenforce 0

Add hostname resolution

Vim / etc/hosts192.168.10.222 node1 192.168.10.223 node22.nis master server configuration

Download the software package

Yum-y install rpcbind ypserv ypbind yp-tools

Add a nis domain name

[root@localhost ~] # nisdomainname skills.com vim / etc/sysconfig/networkNISDOMAIN skills.com

Automatically mount the nis domain name when powered on

[root@localhost ~] # vim / etc/rc.d/rc.local touch / var/lock/subsys/local/bin/nisdomainname skills.com [root@localhost ~] # chmod 777 / etc/rc.d/rc.local

Modify the master profile to restrict permissions

Vim / etc/ypserv.conf192.168.10.0/24:*:*:none / / give access to this network segment 192.168.10.222:*:*:none / / give this local access: *: *: deny / / deny other servers

Restart the service

Systemctl restart yppasswdd rpcbind ypserv systemctl enable yppasswdd rpcbind ypserv

Set up a database

[root@localhost] # / usr/lib64/yp/ypinit-m At this point, we have to construct a list of the hosts which will run NISservers. Localhost is in the list of NIS server hosts. Please continue to addthe names for the other hosts, one per line. When you are done with thelist, type a. Next host to add: localhost next host to add: The current list of NIS servers looks like this: localhost Is this correct? [YBO: y] yWe need a few minutes to build the databases...Building / var/yp/skills.com/ypservers...Running / var/yp/Makefile...gmake [1]: Entering directory'/ var/yp/skills.com'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/skills.com' localhost has been set up as a NIS master server. Now you can run ypinit-s localhost on all slave server. [root@localhost ~] #

Create a new nis account

Useradd nis1-p123 useradd nis2-p123 when the host is changed, cd to / var/yp make [root@localhost ~] # cd / var/yp/ [root@localhost yp] # makegmake [1]: Entering directory'/ var/yp/skills.com'Updating passwd.byname...Updating passwd.byuid...Updating group.byname...Updating group.bygid...Updating netid.byname...gmake [1]: Leaving directory'/ var/yp/skills.com' [root@localhost yp] #

Restart the service

Systemctl restart yppasswdd rpcbind ypserv systemctl enable yppasswdd rpcbind ypserv3.nis client Settings

Download the software package

Yum-y install ypbind rpcbind yp-tools

Add a nis domain name

[root@localhost ~] # nisdomainname skills.com vim / etc/sysconfig/networkNISDOMAIN skills.com

Automatically mount the nis domain name when powered on

[root@localhost ~] # vim / etc/rc.d/rc.local touch / var/lock/subsys/local/bin/nisdomainname skills.com [root@localhost ~] # chmod 777 / etc/rc.d/rc.local

Edit the yp.conf file to set up the main service.

Domain skills.com server 192.168.10.222

Restart the service

Systemctl restart ypbind rpcbind

Yptest to check whether you have joined successfully.

[root@localhost ~] # yptestTest 1: domainnameConfigured domainname is "skills.com" Test 2: ypbindUse Protocol V1: Used NIS server: 192.168.10.222Use Protocol V2: Used NIS server: 192.168.10.222Use Protocol V3:ypbind_nconf: nc_netid: 1 nc_flag: 1 nc_protofmly: 'inet' nc_proto:' udp' nc_device:'-' Nc_nlookups: 0ypbind_svcaddr: 192.168.10.222:740ypbind_servername: 192.168.10.222ypbind_hi_vers: 2ypbind_lo_vers: 2 Test 3: yp_matchWARNING: No such key in map (Map passwd.byname Key nobody) Test 4: yp_firstnis1 nis1:123:1000:1000::/home/nis1:/bin/bash Test 5: yp_nextnis2 nis2:123:1001:1001::/home/nis2:/bin/bash Test 6: yp_masterlocalhost Test 7: yp_order1639387530 Test 8: yp_maplistnetid.bynamegroup.bygidgroup.bynamepasswd.byuidpasswd.bynamemail.aliasesprotocols.bynameprotocols.bynumberservices.byservicenameservices.bynamerpc.bynumberrpc.bynamehosts.byaddrhosts.bynameypservers Test 9: yp_allnis1 nis1:123:1000:1000::/home/nis1:/bin/ Bashnis2 nis2:123:1001:1001::/home/nis2:/bin/bash1 tests failed [root@localhost ~] #

Configure domain user login

[root@localhost] # authselect select nis-- forceBackup stored at / var/lib/authselect/backups/2021-12-13-09-34-52.8NFKZDProfile "nis" was selected.The following nsswitch maps are overwritten by the profile:- aliases- automount- ethers- group- hosts- initgroups- netgroup- networks- passwd- protocols- publickey- rpc- services- shadow Make sure that NIS service is configured and enabled. See NIS documentation for more information. [root@localhost ~] #

The primary server configures nfs to share the home directory.

[root@localhost yp] # vim / etx/exports/home/ * (rw,sync) [root@localhost yp] # exportfs-rvexporting *: / home

Client mounts the primary server home directory

Systemctl restart nfs-server [root@localhost ~] # mount 192.168.10.222:/home/ / home/ [root@localhost ~] # dfFilesystem 1K-blocks Used Available Use% Mounted ondevtmpfs 379852 379852 / devtmpfs 399816 399816 / dev/shmtmpfs 399816 5688 394128 2 / runtmpfs 399816 0 399816 / sys/fs/cgroup/dev/mapper/cl-root 17811456 1615988 16195468 10% / dev/sda1 1038336 196688 841648 19% / boot/dev/sr0 9046654 9046654 0% / mediatmpfs 79960 0% / run/user/0192.168.10.222:/home 17811456 1644672 166784 10% / home [root@localhost] #

Add boot auto-mount main service home directory.

Vim / etc/fstab192.168.10.222:/home / home nfs defaults 0 [root@localhost ~] # mount-a [root@localhost ~] # dfFilesystem 1K-blocks Used Available Use% Mounted ondevtmpfs 379852 379852 / devtmpfs 399816 399816 / dev/shmtmpfs 399816 5688 394128 / runtmpfs 399816 0 399816 / sys/fs/cgroup/dev/mapper/cl-root 17811456 1613680 16197776 10% / dev/sda1 1038336 196688 841648 19% / boot/dev/sr0 9046654 9046654 0% / media192.168.10.222:/home 17811456 1644544 16166912 10% / hometmpfs 79960 0 79960 / run/user/0 [root@localhost ~] #

Here the nis configuration is complete.

Thank you for reading! This is the end of the article on "how to build and configure Centos8 NIS domain service". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report