Example:
http://www.hgc.ims.u-tokyo.ac.jp/announce/systems/manual/HITACHI/manual/8x203506/m0120058.htm
1. Create NIS files using the shell scripts createusers
and createhosts above
2. Modify /var/yp/securenets to restrict
access
3. Explicitly set the NIS Domain name (also edit
/etc/sysconfig/network)
4. Generate the NIS database
5. Configure NIS Master Server as a client
NOTE: station12's IP address
must be in the /etc/hosts file.
6. Configure NIS server and client to start at
boot time
7. Start the server and client daemons now
domain nixrox.nis server station12
domain nixrox.nis broadcast
ypcat: cats the file requested
$ ypcat passwdypwhich: matches your server
$ ypcat hosts
$ ypwhichypmatch: prints the values of the keys requested
ponto.example.com
$ ypmatch pattyo auto.homeyppasswd: changes your password in the NIS database
-rw,noquota ponto:/home/pattyo
$ yppasswd usernameNIS and Security
Adding new NIS mapsIs the server running? $ rpcinfo -u station12 ypserv
If you are running server in broadcast mode
program 100004 version 1 ready and waiting
program 100004 version 2 ready and waiting$ rpcinfo -b ypserv 1
Is the client running? $ rpcinfo -u stationX ypbind
program 100007 version 1 ready and waiting
program 100007 version 2 ready and waiting
- Do you have a NIS domain configured?
$ domainname
nixrox.nis
- Is your machine configured to look at NIS files?
- Check /etc/nsswitch.conf
- Test to see if you have service
$ ypcat hosts
Changes are made on NIS Master Server Our example will be a file with phone numbers in it
- Edit new NIS file
# cat /etc/yp/phone
Dad 222-888-2222
Joel 555-222-6666
Ruth 777-555-3333
Kelly 888-333-5555
Tom 999-444-1111
- Put hooks into /var/yp/Makefile for new map
# vi /var/yp/Makefile
- Build the maps
# make phone
Updating phone...
- Test
# ypcat -k phone
Dad 222-888-2222
Joel 555-222-6666
Ruth 777-555-3333
Kelly 888-333-5555
Tom 999-444-1111Getting new map from the master onto a slave server # /usr/lib/yp/ypxfr -h mastserver phone
Turning a dbm map file into readable text
- in order to edit and add new entries
- rebuild the dbm file again when done
- typically systems administrators write scripts to mange this process
# /usr/lib/yp/makedbm -u ypservers > /tmp/ypservers.txt
- add your new nisslave server here
# vi /tmp/ypservers.txt
- remake the dbm data file and replace it
# /usr/lib/yp/makedbm /tmp/ypservers.txt /var/yp/example.com/ypservers
- Test to see if you see your new entry
# ypcat ypservers