NFS Services Administrator's Guide (B.11.31.02) January 2008
NOTE: The -null entry must precede the included map entry to be effective.
Using Executable Maps
An executable map is a map whose entries are generated dynamically by a program or a script.
AutoFS determines whether a map is executable, by checking whether the execute bit is set in
its permissions string. If a map is not executable, ensure that its execute bit is not set. An
executable map is an indirect map.
When the AutoFS daemon locates a map whose execute bit is set, then instead of opening the
file and searching for an entry, the daemon executes the file as a program and passes the key to
be located within the map as an argument. Executable AutoFS maps return a map entry on the
standard output. If they cannot supply a map entry for the key, they do not return anything.
You can list executable AutoFS maps in the master map or include them in the local AutoFS map
files. However, executable maps cannot be used with NIS and LDAP.
For example, an executable map implemented as a shell script, emulates the AutoFS built-in
-hosts map for /net. It obtains a list of exported file systems from an NFS server (its name is
the key argument). It then formats the path names into a multiple-mount map entry and sorts
the list to order the mounts correctly into a top-down hierarchy, as follows:
!/bin/sh
Server=$1
showmount -e $1 | awk ‘NR > 1 {print $1 “\t'$Server’:” $1 ” \\ “}’ | sort
Advanced AutoFS Administration
This section presents advanced AutoFS concepts that enable you to improve mounting efficiency
and also help make map building easier. This section addresses:
• “Automounting Multiple Directories (Hierarchical Mounts)” (page 76)
• “Configuring Replicated Servers for an AutoFS Directory” (page 77)
• “Including a Map in Another Map” (page 78)
• “Creating a Hierarchy of AutoFS Maps” (page 78)
Automounting Multiple Directories (Hierarchical Mounts)
AutoFS enables you to automount multiple directories simultaneously.
Use an editor to create an entry with the following format in a direct or indirect map, and if
needed, create the auto_master entry:
local_dir /local_subdirectory
[-options] \ server:remote_directory \
/local_subdirectory [-options]
server:remote_directory \
...
Adding these map entries does not automatically mount them. The listed remote directories are
mounted only when referenced. For example, the following entry from a direct map mounts the
source code and the data files for a project whenever anyone requests access to both of them:
/our_project /source -ro basil:/opt/proj1/src \
/datafiles thyme:/opt/proj1/samples/data
The following is another example from an indirect map.
chap2 -nosuid /text thyme:/our_book/chap2 \
/graphics basil:/our_book/artwork/chap2 \
/old thyme:/our_book/oldfiles/chap2
The nosuid mount option applies to all three automounted directories. For more information
on the nosuid mount option, see automount(1M).
76 Configuring and Administering AutoFS