This
module discusses the actual set up of
Setting up a
files
When a
/etc/inet/hosts -
/etc/nsswitch.conf
Each
database used in
data: where_to_look
As
an example:
hosts
passwd files
These
two nsswitch.conf entries show most of the possible permutations. For hosts, which associates hostnames with IP
addresses, the first entry in the "where to look" column is "
For
passwd, which associates usernames with UIDs, GIDs, etc, the first entry is
file, so system looks first in the system file /etc/passwd. If no entry is found in the local file
/etc/passwd, the system then looks in the
Every
time a lookup is attempted, some kind of return is given. If the system finds the requested
information, the result is SUCCESS. By
default, if SUCCESS is returned, the system executes the action
"return", which causes it to stop looking for the data. If the server or map is unavailable, the
return is UNAVAIL; if the server tells the client it's busy, the return is TRY
AGAIN, and if the entry is not found, the return is NOT FOUND. In all these cases, the system executes the action "continue,"
which tries the next listed source for the entry.
It
is possible to force the action you want to take place. If you want the system to stop looking for
the host data if the
For
automounted resources, such as the direct map or the auto home map,
commands to set up a
cp
/etc/nsswitch.nis /etc/nsswitch.conf (customize as required).
domainname sets the
domainname
rm4.ebay.sun.com
The
domain name must be added to the file /etc/defaultdomain
domainname
> /etc/defaultdomain
ypinit -c which prompts for the list of servers.
svcadm enable nis/client which starts the
Setting up a NIS Master
Server
files
The
NIS Server is also a client, so the servers must be set up as a client up to
the point where you run ypinit.
1.
Check /etc/hosts
2.
Copy /etc/nsswitch.nis to /etc/nsswitch.conf and customize the file as you
want.
3.
Set the
4.
Populate the file /etc/defaultdomain with the domain name.
In
addition, there are two important sets of files on the
The
second group of
map.key.pag
or map.key.dir
Where
"map" is the name of the data (hosts, passwd, etc.)
"key"
is the way the data in the map are sorted, whether by name (byname) or by the
address (byaddr) in the case of "hosts", and the type of map; actual
data files end in .pag, while indexes of the data files end in .dir.
Each
map contains entries consisting of 2 items: for "byname" maps, the
first entry, called the "key," will be the name, and the second the
numerical value; for "byaddr" maps, the IP address (for example) will
be first and the name second.
The creation of the maps is controlled by the file /var/yp/Makefile. A make file is a file that controls
compilation of a program. It is used in
programming when a program has multiple subroutines, uses a number of libraries
and generally is complex. Make files are
ASCII files and can be altered to change the exact way that compilation occurs.
The Makefile is run by ypinit –m, but can also be run after
cd
/var/yp
/usr/ccs/bin/make
commands to set up a
cp
/etc/nsswitch.nis /etc/nsswitch.conf (customize as required).
touch
/etc/ethers /etc/bootparams /etc/netgroup /etc/timezone /etc/audit_user
/etc/auto_direct
domainname
rm4.ebay.sun.com
domainname
> /etc/defaultdomain
ypinit -m sets up the master server
by building the master maps and setting up a list of slave servers.
svcadm enable nis/server starts the
Setting up a
1.
Check /etc/hosts
2.
Copy /etc/nsswitch.nis to /etc/nsswitch.conf and customize the file as you
want.
3.
Set the
4.
Populate the file /etc/defaultdomain with the domain name.
5.
ypinit -c
6. svcadm
enable nis/client.
7. svcadm disable nis/client
8. ypinit -s master_server_name
Pulls the
9. svcadm enable nis/server starts the
files
The
map files needed on the slave server are pulled over from the master server.
ypwhich lists the the name of the master server
ypwhich -m
lists all the databases on the master server
ypcat map lists the contents of the
database "map"
ypmatch key lists
all values of "key" from all map files.
ypmatch key map lists the value of the key from a specific map file
(used
when more than one database contains that key value)
/usr/lib/netsvc/yp/ypstop stops the
Updating
When
users or hosts are added or other changes are made, they have to be added to
the
1.
To update the
cd /var/yp
/usr/ccs/bin/make
2.
To transfer the
On
the slave server:
/usr/lib/netsvc/yp/ypxfr
map_name
OR
ypinit -s master_server_name to transfer all maps (on
the slave server)
OR
automatically using the scripts (usually
set up as cron jobs on the slave server)
/usr/lib/netsvc/yp/ypxfr_1perhour
/usr/lib/netsvc/yp/ypxfr_1perday
/usr/lib/netsvc/yp/ypxfr_2perday
password maintenance
The
file containing passwords is changed more often than any other file, and is the
only database in NIS changed by users, so it can be set up to be automatically
pushed. The daemon required is called rpc.yppasswdd and is started by
ypinit -m, but if it fails to start, or
is killed, it can be restarted with the command:
/usr/lib/netsvc/yp/rpc.yppasswdd -D <pwdir from makefile> -m
where
the –m option causes the make on passwd to be automatically performed whenever
passwords are changed, and the –D is followed by the name of the directory containing
the password and shadow files (usually the value of the macro PWDIR in the
Makefile).
Passwd
can now be changed normally by any user with passwd. Because
At
the end of the lab, remove
1. svcadm
disable nis/server|client– stops the
2.
domainname " "
3.
rm /etc/defaultdomain
4.
cp /etc/nsswitch.files /etc/nsswitch.conf
5.
cd /var/yp
6.
remove all files from /var/yp/domainname and /var/yp/binding.