Configuring the NFS automounter

Setting automount environment variables

automount provides for the use of environment variables within a direct, indirect, or master map entry. Using environment variables is helpful for users who wish to manage automount maps with NIS. The advantage of using NIS is being able to maintain a single map for distribution to multiple clients. If such a map requires a value that varies from client to client, it can be replaced by an environment variable. This allows several clients to use the same map entry but still be mounted on different servers.

Environment variables can be used by prepending a dollar sign ($) to the name of the variable. Braces are used to delimit the name of the environment variable from appended letters or digits. These variables can be used anywhere in an entry line, except as a key.

Environment variables can either be inherited from the environment or can be defined explicitly with the -D command-line option. For instance, if you want each client to mount client-specific files in the network in a replicated format, create a specific map for each client according to its name, so that the relevant line for host milan is:

   /mystuff        acapulco,tokyo,sydney:/export/hostfiles/milan
For moscow it is:
   /mystuff        acapulco,tokyo,sydney:/export/hostfiles/moscow
This scheme is viable within a small network, but maintaining this kind of host-specific map across a large network would soon become unfeasible. The solution in this case is to start automount with a command line similar to:

automount -D HOST=`hostname` ...

The entry in the direct map should read:

   /mystuff        acapulco,tokyo,sydney:/export/hostfiles/$HOST
Now each host finds its own files in the mystuff directory, and the task of centrally administering and distributing the maps becomes easier.

See also:

Next topic: Creating local automount maps
Previous topic: Mixing local and distributed automount maps

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003