NIS and Linux Networking

Network Information System (NIS) in Linux Explained

Learn how NIS, the Network Information Service, shares user and host lookup data across Linux systems, what its parts do, and why it is now seen as legacy.

On this page
  1. What NIS is and what it does
  2. How NIS organizes its data
  3. The main components
  4. How a Linux client uses NIS
  5. Checking an NIS setup
  6. Troubleshooting in order
  7. Security and limits
  8. Where NIS fits today
  9. Summary

What NIS is and what it does

NIS is a directory service that lets Unix and Linux systems share lookup data, such as user accounts, groups and host names, from a central server. It is often written as Network Information Service, and many guides use the title’s wording, network information system in Linux. Older material also refers to it as Yellow Pages, or YP.

Without a service like NIS, you would have to keep /etc/passwd, /etc/group and /etc/hosts in sync on every machine by hand. With NIS, you keep one copy of each table on a server, and client machines ask that server when they need an answer. That makes it easier to add a user once and have them work across a group of machines.

NIS is an older technology. Most new deployments use LDAP, Active Directory, FreeIPA or SSSD for central identity, so you are more likely to meet NIS in an existing or legacy network than in a new build.

How NIS organizes its data

NIS stores its data in tables called maps. Each map is built from a plain text file. Common maps include:

  • passwd, which holds user account entries
  • group, which holds group entries
  • hosts, which holds host name to address pairs
  • netgroup, which holds named sets of hosts and users

Maps are grouped under an NIS domain. An NIS domain is not the same as a DNS domain. It is a separate name that each machine is set to use, and it does not have to match your DNS domain. On Linux, you can view or set it with the domainname command.

The main components

A typical NIS setup uses a few daemons and tools:

  • ypserv is the server daemon. It answers lookup requests for the maps in its domain.
  • ypbind is the client daemon. It finds an NIS server for the domain and keeps that binding up to date.
  • rpcbind registers the RPC services NIS uses, so clients can find them. NIS depends on it, and older systems called it portmap.
  • A password update service, often called yppasswdd, lets users change passwords stored in NIS.
  • A Makefile, usually kept in /var/yp, rebuilds the maps after you change the source files.

Service names and file locations vary by distribution, so check the documentation for your version before you change anything.

How a Linux client uses NIS

On Linux, the order in which lookups are tried is set in /etc/nsswitch.conf. Each line names a database and the sources to check, in order. A typical entry looks like this:

passwd: files nis
group:  files nis

With this setup, the system checks local files first, then asks NIS. Some systems also use a small configuration file, such as /etc/yp.conf, or the ypbind settings to name the server the client should use. Check the one for your distribution.

Checking an NIS setup

A few commands show whether a client is working with NIS:

  • domainname prints the NIS domain the machine is set to use.
  • ypwhich shows which NIS server the client is bound to.
  • ypcat passwd prints the contents of the passwd map.
  • rpcinfo -p lists the RPC services registered with rpcbind. On a server, you should see ypserv in the list.
  • getent passwd username asks the system to look up a user the way applications do, through nsswitch.

If a user can log in on the server but not on a client, getent is often the fastest way to see whether the lookup reaches NIS at all.

Troubleshooting in order

When lookups fail, work through these checks in order:

  1. Confirm the NIS domain name on the client with domainname.
  2. Confirm the client is bound to a server with ypwhich.
  3. Confirm the server’s RPC services are registered with rpcinfo -p.
  4. Check the nsswitch.conf entries for the database that fails.
  5. Check the firewall. rpcbind uses port 111, and the NIS daemons may use ports that you need to allow.

When a client stops getting answers after a change, restarting the client service is often part of the fix. For the general steps, see how to restart network services in Linux before you change anything on a production machine.

Security and limits

Standard NIS does not encrypt its traffic, and its traditional design trusts the local network. Anyone who can reach the server and knows the domain name may be able to query its maps. Password data needs careful handling, and many security guides advise against running NIS on networks you do not control.

If you must run NIS, keep it on a segment you manage, restrict access with firewall rules, and plan a migration. Keeping it safe is part of the wider job covered in what are the responsibilities of a network administrator, so make sure the people who own the service are clear on their duties before they change it.

Where NIS fits today

NIS still appears in older labs, legacy networks and some specialized environments. For new systems, central identity is usually handled by LDAP, Active Directory, FreeIPA or SSSD, which offer encryption, stronger authentication and better tooling. Moving from NIS is a planned project: you map each NIS table to its replacement, test with a small group of machines, and then retire the old servers.

Summary

NIS, the Network Information Service, shares user, group and host lookup data from a central server to Linux and Unix clients. It works through maps, an NIS domain, and a small set of daemons. You configure clients through nsswitch, check them with commands such as ypwhich and ypcat, and troubleshoot in a clear order. Because it does not encrypt its traffic, it suits legacy networks you control rather than new designs.

Keep exploring

Guides from other topics

All topics →