The NIS server is mainly used to manage users' accounts and passwords in a unified manner. It has the following meanings: Assume that there are 20 Linux Hosts in the company. for employees in the company, they can access all the 20 Linux Hosts. We assume that a company member needs to change the password so that they can log on to all the hosts, the traditional thinking is to execute passwd on these 20 too many Linux Hosts separately, which is very inefficient and inconvenient for managers, therefore, the NIS service solves this problem. The principle is
The NIS server is mainly used to manage users' accounts and passwords in a unified manner. It has the following meanings: Assume that there are 20 Linux Hosts in the company. for employees in the company, they can access all the 20 Linux Hosts. We assume that a company member needs to change the password so that they can log on to all the hosts, the traditional thinking is to execute passwd on these 20 too many Linux Hosts separately, which is very inefficient and inconvenient for managers, therefore, the NIS service solves this problem. The principle is to save all user account and password information on the NIS server, when a user logs on to one of the Linux Hosts and performs account and password verification, the logon host sends a verification request to the NIS server. If the authentication is correct, the user logs on successfully, otherwise, the user fails to log on.
The NIS Server saves the user's account and password in the database file. The NIS client sends a request to it through RPC (Remote Procedure Call.
All NIS clients are requested by an NIS server. Therefore, an account can be used to log on to all Linux Hosts. After you modify your password, it is synchronized to the database file of the NIS server. This completes the effect of multiple changes and is very convenient for account management.
1. NIS Server Configuration
1. confirm that the required software has been installed
Yp-tools: Provides NIS-related query commands.
Ypbind: because the Client and Server need to communicate, bind is required.
Ypserv: NIS Server Configuration Software
Rpcbind: Required Software for RPC
2. Start configuring the NIS Server
1> set the Domain Name of the NIS Server
Nisdomainname domainname
Vi/etc/sysconfig/network
: NISDOMAIN = domainname: Set Domain Name
: YPSERV_ARGS = "-p 1011" sets NIS to be started on a fixed port, that is, 1011. This is to facilitate the use of iptables to directly manage NIS in the future.
# Automatically set domain name upon startup
Vi/etc/rc. local
/Sbin/nisdomainname domainname # Add
2> Configure the main file/etc/ypserv. conf
[Host Name/IP] [NIS domain name] [available database name] [security restrictions]
192.168.171.0/255.255.255.0: *: none
[Security restrictions]: including none, port less than 1024, and deny rejection.
3> set the Host Name and IP address
Vi/etc/hosts
192.168.171.135 nisserver
192.168.171.136 nisclient01
192.168.171.20.nisclient02
...
The corresponding IP addresses and host names of all hosts must be written here.
4> Start and view Related Services
Vi/etc/sysconfig/yppasswdd
YPPASSWDD_ARGS = "-- port 1012" find the location and modify it to this
/Etc/init. d/ypserv start
/Etc/init. d/yppasswdd start
Chkconfig ypserv on # Set to auto-start upon startup
Chkconfig yppasswd on
Rpcinfo-u localhost ypserv
# The following words are displayed, indicating that they are normal #
Program 100004 version 1 ready and waiting
Program 100004 version 2 ready and waiting
5> process the account and create a database
Useradd-u 1001 testuser01
Useradd-u 1002 testuser02
Useradd-u 1003 testuser03
Echo testuser01 | echo passwd -- stdin testuser01
Echo testuser02 | echo passwd -- stdin testuser02
Echo testuser03 | echo passwd -- stdin testuser03
# In this way, the three users testuser01 testuser02 testuser03 have the same password and user name.-u indicates the specified uid.
# Next, convert the account and password data to the database.
/Usr/lib64/yp/ypinit-m
Note: If the user password has changed, you need to re-create the database and restart ypserv and yppasswdd.
For example, if the user useradd somebody or passwd somebody is added to the server, the database must be re-created, that is,/usr/lib/yp/ypinit-m.
6> firewall settings
Here, the NIS Server firewall is disabled: service iptables stop