Network Information System
Definition:
NIS provides generic database access facilities that can be used to distribute information such as that contained in the passwd and groups files to all hosts on your network.
Objectives:
To make the network appear just as a single system, with the same accounts on all hosts.
To provide an environment to your users that makes the network transparent.
To keep vital data such as user account information synchronized between all hosts.
NIS comprises:
A RPC server.
A client-side library.
Several administrative tools.
Note:
Originally, NIS was called Yellow Pages, or YP, which is still widely used to informally refer this service. Yellow Pages is a trademark of British Telecom, which required Sun to drop that name.
Maps
NIS keeps database information is in so-called maps containing key-value pairs.
Maps are stored on a central host running the NIS server, from which clients may retrieve the information through various RPC calls.
Creation:
The maps are usually generated from master text files such as /etc/hosts or /etc/passwd.
For some files, several maps are created, one for each search key type:
Master File Maps /etc/hosts hosts.byname, hosts.byaddr /etc/networks networks.byname, netwosks.byaddr /etc/passwd passwd.byname, passwd.byuid /etc/group group.byname, group.bygid /etc/services services.byname, services.bynumber /etc/rpc rpc.byname, rpc.bynumber /etc/protocols protocols.byname, protocols.bynumber /usr/lib/aliases mail.aliases
ypcat:
The command ypcat lists the maps in the same way the command cat would list the master files:
% ypcat passwd
NIS servers
The NIS server is traditionally called ypserv.
Types:
For an average network: a single server usually suffices.
For big networks: Many servers synchronized servers in a master-slave scheme:
Maps will be created only on the master server's host.
From there, they are distributed to all slaves.
NIS domains
Definition:
NIS domains are the collection of all hosts that share part of their system configuration data through NIS.
Characteristics:
NIS domains have a purely administrative function only.
They are mostly invisible to users, except for the sharing of passwords between all machines in the domain.
The name given to a NIS domain is relevant only to the administrators.
NIS domains determine which NIS server an application will query.
Finding a NIS server:
Configuration file:
A file that names the host on which to find the server.
Disadvantage: This approach is inflexible, because it doesn't allow clients to use different servers, depending on their availability.
ybbind:
ypbind probes for servers by broadcasting to the local IP-network; the first to respond is assumed to be the potentially fastest one and will be used in all subsequent NIS queries.
Disadvantage: ypbind blindly believes whoever answers, which could be a humble NIS server as well as a malicious intruder.
The Client Side of NIS
Without NIS:
Functions like:
getpwnam(3), which return the account information associated with the given user name.
getpwuid(3), which return the account information associated with the given user id.
Perform the requested lookup on the standard file, such as /etc/passwd.
With NIS:
There is a NIS-aware implementation of these functions in the C-library.
They place RPC calls to have the NIS server look up the user name or id.