NFS Services Administrator's Guide (B.11.31.02) January 2008

IMPORTANT: You cannot use environment variables in the AutoFS master map.
In this example `the NFS serverbasil, contains subdirectories in its /export/private_files
directory, which are named after the hosts in its network. Every host in the network can use the
same AutoFS map and the same AUTOMOUNTD_OPTIONS definition to mount its private files
from basil.
When AutoFS starts up on the host sage, it assigns the value sage to the HOST variable. When
you request access to the local /private_files directory on sage, AutoFS mounts
/export/private_files/sage from basil.
To use environment variables as shortcuts in direct and indirect maps, follow these steps:
1. To enable the automount command to expand the environment variable to its current value
of the client's hostname, modify the direct map entry on the server, basil, as follows:
/private_files basil:/export/private_files/$HOST
In the direct map entry, HOST, is the environment variable.
2. Add the -D option to the AUTOMOUNTD_OPTIONS variable in the
/etc/rc.config.d/nfsconf file to assign a value to the variable, as follows:
AUTOMOUNTD_OPTIONS=-D HOST='hostname'
NOTE: You can also use the /etc/default/autofs file to modify the value assigned
to the variable.
You can use any environment variable that is set to a value in an AutoFS map. If you do not set
the variable either with the -D option in /etc/rc.config.d/nfsconf file or by using the
/etc/default/autofs file, AutoFS uses the current value of the environment variable on the
local host.
For information on some of the pre-defined environment variables, see automount(1M).
Using Wildcard Characters as Shortcuts in AutoFS Maps
Using wildcard characters makes it very easy to mount all the directories from a remote server
to an identically named directory on the local host.
Consider the following guidelines while using wildcard characters as shortcuts:
Use an asterisk (*) as a wildcard character in an indirect map, to represent the local
subdirectory if you want the local subdirectory to be the same as the remote system name,
or the remote subdirectory.
You cannot use the asterisk (*) wildcard in a direct map.
Use an ampersand (&) in a direct or an indirect map as the remote system name or the remote
subdirectory. The entry in the local directory name field replaces the ampersand. If you have
used an asterisk to represent the local subdirectory, then the entry that replaces the asterisk
(*) in the local subdirectory field also replaces the ampersand (&) in the remote system name,
or remote subdirectory field.
Notes on Using Wildcard Characters as Shortcuts in Maps
The following example illustrates the automounting of the users’ home directories. The home
directories are physically located on the NFS server, basil, under the remote directory
/export/home. On the local NFS client, the home directories are mounted under /home.
The following entry from the /etc/auto_master master map lists the indirect map,
/etc/auto_home:
# /etc/auto_master file
# local mount-point map name mount options
Using Wildcard Characters as Shortcuts in AutoFS Maps 71