How To Set Up NIS for Ubuntu servers
Last updated on May 9, 2022 8:28 PM
Network Information Service (NIS) is a distributed naming service based on Remote Procedure Call (RPC). It enables easy sharing of various information across the cluster including username, password, hosts and service ports. Such a centralized user management system is also a necessary prerequisite for setting up cluster management system including SLURM, which requires user & group synchronization across the cluster.
NIS uses a client-server arrangement. By running NIS, the system administrator can distribute administrative databases, called maps, among a variety of servers. Servers are further divided into master and slave servers: the master server is the true single owner of the map data. Slave NIS servers handle client requests, but they do not modify the NIS maps. The master server is responsible for all map maintenance and distribution to its slave servers. Once an NIS map is built on the master to include a change, the new map file is distributed to all slave servers.
Clients are hosts that request information from these maps. NIS clients “see” these changes when they perform queries on the map file — it doesn’t matter whether the clients are talking to a master or a slave server, because once the map data is distributed, all NIS servers have the same information.
NIS uses domains to arrange the machines, users, and networks in its namespace. However, it does not use a domain hierarchy; an NIS namespace is flat.
You’ll be prompted to enter your preferred domain name during the installation process. Here the domain name is
NISSERVER to be
/etc/hosts, there should be at least all the slave servers.
TIPS: NIS usually is for info sharing in LAN. However, as long as port
rpcbind) is open, it is capable of doing RPC call across internet.
ypinit -m, NIS will utilize the local user system as its cornerstone to build the network user information.
You’ll be prompted to enter the list of servers (master and slave). The first host added should be the hostname of the master server, followed by all the slave servers in the system.
During the process it will also prompt to enter domain name. Use the same domain as the NIS master.
Add the master / slave server you want to request info from.
If you want to use hostname instead of server IP, make sure to specify it in
/etc/hosts of the client.
The name service switch (named
nsswitch.conf) controls how a client machine or application obtains network information.
Each machine has a switch file in its
/etc directory. Each line of that file identifies a particular type of network information, such as
group, followed by one or more locations of that information.
A client can obtain naming information from one or more of the switch’s sources. For example, an NIS client could obtain its hosts information from an NIS map and its password information from a local
/etc file. In addition, the client could specify the conditions under which the switch must use each source.
The available information sources are listed in the following table:
|A file stored in the client’s |
|An NIS+ table. For example, the |
|An NIS map. For example, the |
|Can be used to specify that host information be obtained from DNS.|
|Can be used to specify entries be obtained from the LDAP directory.|
/etc/nsswitch.conf to add
nis as an information source.
nis to the end of
If you want to look up
nis first instead of local files. Put
nis [NOTFOUND=return] in front of
[NOTFOUND=return] search criterion instructs the switch to stop searching the NIS tables if the switch gets a “No such entry” message. The switch searches through local files only if the NIS server is unavailable.
The set up process of slave server is an approximate combination of client set up + master set up.
Specifically Step 1 to 4. This is for establishing RPC connection with master.
NISSERVER to be
It is important to allow the master server to access.
/etc/hosts, there should be at least the IP of master server.
This operation will pull information from the master to the slave.
If the slave master is not added in Step 5 of master set up. On master server, it is necessary to rerun
ypinit -m and add the slave server when it prompts to enter the hosts.
In order to push the changes in the maps on master, you also need to edit the
- System Administration Guide: Naming and Directory Services (DNS, NIS, and LDAP)
- Eisler, M., Labiaga, R., & Stern, H. (2001). Managing NFS and NIS: Help for Unix System Administrators. O’Reilly Media, Inc.
- How to set up NIS for Ubuntu (Master, Client, Slave) — Junyong Lee
- 鳥哥的 Linux 私房菜：伺服器架設篇 — 第十四章、帳號控管： NIS 伺服器