ITEM: R2568L

How to configure NIS automounter


HOW TO CONFIGURE NIS AUTOMOUNTER

The NIS master server will manage all the automount maps.
The client will have maps that point to their corresponding maps
on the NIS server. Make sure that NIS is up and running on all machines
involved:

type in 'ypwhich' on all machines and make sure
they are all bound to the same NIS master server.

------------------------
NIS server configuration
------------------------

The NIS server will have an auto.master map located always
in the directory specified by the DIR paremeter in the 
/var/yp/Makefile file.  It defaults to the /etc directory.
We will leave the default directory for our examples.
The NIS server will also contain all other maps
that will be automounted to the client.  These maps are also
located the directory specified by the DIR parameter in /var/yp/Makefile.
In our example we will have one file system to be automounted.

In this example we will have two maps on the server(Grumpy is our server):

/etc/auto.master     (If the DIR parameter in /var/yp/Makefile is set to /tmp
/etc/auto.mcmillan   (then our example would be /tmp/auto.master and /tmp/auto.mcmillan

The auto.master map contains all the maps that are
to be automounted.  (You must use the map name auto.master
for the map that stores all other maps unless you use the automunt
with the -f flag). The auto.mcmillan map is a map that is 
going to be automounted.

auto.master map
---------------

The /etc/auto.master map format:

\    \

$vi /etc/auto.master
/home/tmp       /etc/auto.mcmillan

* Save file

In this example we are going to mount the filesystem, located
in the /etc/auto.mcmillan file, onto /home/tmp.
Make sure the /home/tmp filesystem already exists.

auto.mcmillan map
-----------------

The /etc/auto.mcmillan map format:

Subdirectory    MountOptions    ServerName:ServerDirectory

$vi /etc/auto.mcmillan
mcmillan        -rw,hard,intr   grumpy:/home/mcmillan

This map says we are going to automount the filesystem
/home/mcmillan from the the host grumpy onto /home/tmp on
the automount client machine. The Subdirectory mcmillan
will be appended to /home/tmp.  Therefore the path is
/home/tmp/mcmillan.  You can mount any filesystem
from any host that is in the NIS domain.

Mount options:

-rw: mounts the filesystem as read/write
hard: mount filesystem hard
intr: is the interrupt value.

Update the /var/yp/Makefile file
--------------------------------

The following stanza must be added to the Makefile file:

auto.master.time: $(DIR)/auto.master
        -@if [ -f $(DIR)/auto.master ] ; then \\
                $(MAKEDBM) $(DIR)/auto.master
$(YPDBDIR)/$(DOM)/auto.master; \\
                touch auto.master.time ; \\
                echo "updated auto.master" ; \\
                if [ ! $(NOPUSH) ] ; then \\
                        $(YPPUSH) auto.master ; \\
                        echo "pushed auto.master" ; \\
                else \\
                        : ; \\
                fi \\
        else \\
                echo "couldn't find $(DIR)/auto.master" ; \\
        fi

Also, you must add a line for each additional map.  In our
example we need a stanza for auto.mcmillan map.  It is the
same format as above except whereever it says master replace
it with mcmillan.

auto.mcmillan.time: $(DIR)/auto.mcmillan
        -@if [ -f $(DIR)/auto.mcmillan ] ; then \\
                $(MAKEDBM) $(DIR)/auto.mcmillan
$(YPDBDIR)/$(DOM)/auto.master; \\
                touch auto.mcmillan.time ; \\
                echo "updated auto.mcmillan" ; \\
                if [ ! $(NOPUSH) ] ; then \\
                        $(YPPUSH) auto.mcmillan ; \\
                        echo "pushed auto.mcmillan" ; \\
                else \\
                        : ; \\
                fi \\
        else \\
                echo "couldn't find $(DIR)/auto.mcmillan" ; \\
        fi

This file is very picky.  Copy it exactly as you see it.
This line:

                  $(MAKEDBM) $(DIR)/auto.mcmillan
$(YPDBDIR)/$(DOM)/auto.master; \\

is one line.  Do not enter a return carriage.  Just tab over
to start typing in $(YPDBDIR)/$(DOM)/auto.master.
Where there looks like there is a tab make sure there is a tab.
Where there looks like there is a space make sure there is a space.
Where there looks like there is no space make sure there is no space.
Do not try to cut and paste one stanza in this file.  It will convert
all the tabs to spaces.  If you do cut and paste, remember to replace
the tabs in the appropriate areas.

Second Step:

Edit the all: parameter in this Makefile and place in all maps. In our example
auto.master and auto.mcmillan should be added.

all: passwd group hosts ethers networks rpc services protocols \\
auto.master auto.mcmillan netgroup bootparams aliases publickey netid netmasks

Third Step:

At the very bottom of the file you must
add the maps in two stanzas:  In our example we must add

auto.master: auto.master.time
auto.mcmillan: auto.mcmillan.time
 to the stanza:

passwd: passwd.time
group: group.time
hosts: hosts.time
ethers: ethers.time
networks: networks.time
rpc: rpc.time
services: services.time
protocols: protocols.time
netgroup: netgroup.time
bootparams: bootparams.time
aliases: aliases.time
publickey: publickey.time
netid: netid.time
netmasks: netmasks.time

and you must add

$(DIR)/auto.master:
$(DIR)/auto.mcmillan:

to the stanza:
$(DIR)/passwd:
$(DIR)/security/passwd:
$(DIR)/group:
$(DIR)/hosts:
$(DIR)/ethers:
$(DIR)/networks:
$(DIR)/rpc:
$(DIR)/services:
$(DIR)/protocols:
$(DIR)/netgroup:
$(DIR)/bootparams:
$(DIR)/publickey:
$(DIR)/netid:
$(ALIASES):
$(DIR)/netmasks:

* Save this file

Build the map
-------------

We must now build our NIS maps.
In our example we must build auto.master
and auto.mcmillan.

$cd /var/yp
$make auto.master
$make auto.mcmillan

We are now done configuring the NIS server:

------------------------
NIS client configuration
------------------------

Create a corresponding map on client:
------------------------------------

You must create a map on each NIS client corresponding
to the map on the NIS server that is going to use
NIS automounter.

In our example:

$vi /etc/auto.mcmillan
+auto.mcmillan

* Save file

This argument in this map will go to the
auto.master map to look for the definition
of the auto.mcmillan map.

Start NIS automounter:
---------------------

Type in 'usr/sbin/automount'

Now cd /home/tmp/mcmillan
Everything should be working fine.

To stop automounter:
-------------------

Make sure no one is in the automounted directoryand no process is running in that automounted
directory.  Then issue the following:

$ps -ef | grep automount
$kill \
$unmount \

DO NOT DO A 'KILL -9 \'

VERY IMPORTANT NOTE:

If someone is in the automounted directory or a process is running in that
directory when you stop automounter the system will crash.  A kill -9 will
also crash your system.



Support Line: How to configure NIS automounter ITEM: R2568L
Dated: February 1995 Category: N/A
This HTML file was generated 99/06/24~13:30:37
Comments or suggestions? Contact us