Enhanced AutoFS Administrator's Guide, September 2005
Configuring and Administering AutoFS
Shortcuts for AutoFS Maps
Chapter 3 49
Shortcuts for AutoFS Maps
This section includes information on the elements that you can use as
shortcuts in AutoFS maps. You can use environment variables and
wildcard characters as shortcuts in AutoFS maps.
Environment Variables
You can use an environment variable anywhere in a direct or indirect
AutoFS map, except the first field, which specifies the local mount point.
You must precede an environment variable by a dollar sign ($), or enclose
it in curly braces {}. The following direct map uses a variable called
HOST:
/private_files sage:/export/private_files/$HOST
To assign a value to the variable, add the -D option to the
AUTOMOUNTD_OPTIONS variable in the /etc/rc.config.d/nfsconf file;
see the following example:
AUTOMOUNTD_OPTIONS=”-D HOST='hostname'”
In the preceding example, the NFS server, sage, has subdirectories in its
/export/private_files directory that 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
the sage server.
For example, when AutoFS starts up on the basil host, it assigns the
value basil to the HOST variable. Then, when someone requests access to
the local /private_files directory on basil, AutoFS mounts
/export/private_files/basil from the sage server.
You can use any environment variable that is set to a value in an AutoFS
map. If you do not set the variable with the -D option in
/etc/rc.config.d/nfsconf, AutoFS uses the current value of the
environment variable on the local host.
NOTE You cannot use environment variables in the AutoFS master map.