autofs(1M)                                                          autofs(1M)


NAME
     autofs - install automatic mount points

SYNOPSIS
     /usr/etc/autofs [ -v ] [ -t duration ] [ -r ]

DESCRIPTION
     autofs is a command that installs AutoFS mount points and associates an
     AutoFS map with each mount point.  The AutoFS filesystem monitors
     attempts to access directories within it and notifies the autofsd(1M)
     daemon.  The daemon uses the map to locate a filesystem, which it then
     mounts at the point of reference within the AutoFS filesystem.  If the
     filesystem is not accessed within an appropriate interval (five minutes
     by default), the autofsd daemon unmounts the filesystem.

     AutoFS is started by the /etc/init.d/network script, if the configuration
     flags ``nfs'' and ``autofs'' are set ``on'' at system initialization.
     (See autofsd(1M).)  The script starts the autofsd daemon and invokes the
     autofs command.  The autofs command consults the master map, a local file
     named /etc/auto_master, for a list of AutoFS mount points and their maps.
     The master map contains the locations of all AutoFS mount points.  By
     default, /etc/auto_master contains an entry for the -hosts map:


          /hosts         -hosts         -nosuid

     Each entry in the master file specifies a directory on which an AutoFS
     mount will be made followed by the AutoFS map to be associated with that
     mount point.  If map's name begins with a slash then it is assumed to be
     the pathname of a local file, otherwise the location of the map is
     determined by the policy of the name service switch according to the
     entry for the automounter in /etc/nsswitch.conf (see section ''Included
     Maps'' for example of entry's syntax). Mount options may be supplied as
     an optional third field in each entry. These options are used for any
     entries in the map that do not specify mount options explicitly.

     AutoFS maps can be executable binary or script files too. Any AutoFS map
     pointing to a file with execute permission set may be considered an
     executable map file which the autofs daemon will attempt to execute at
     mount time. The output (on stdout) of this executable map file is used as
     part of the AutoFS map. Look at the -E option in the autofsd man page for
     more information on executable maps.

     The executable AutoFS map has to specify the full path for the file, i.e.


          /share         /etc/auth.share               -nosuid


     The autofs command is usually run without arguments.  It compares the
     entries in /etc/auto_master with the current list of AutoFS mounts in
     /etc/mtab and adds, removes or updates AutoFS mounts to bring the


     /etc/mtab up to date with /etc/auto_master. At boot time the autofs
     command installs all AutoFS mounts from the master map.  Subsequently, it
     may be run to install AutoFS mounts for new entries in the master map, or
     to perform unmounts for entries that have been removed.

OPTIONS
     -t duration
          Specify a duration, in seconds, that a filesystem is to remain
          mounted when not in use.  The default is 300 (5 minutes).

          Note that it is impossible to guarantee that a filesystem will be
          unmounted exactly after the specified number of seconds since the
          last access. It is possible to get the better accuracy by decreasing
          the time during which a filesystem is to remain mounted but it will
          result in the increased resource usage by autofs since checks would
          have to be performed more often. On a machine with significant
          number of mounted filesystems setting duration to a value below 10
          seconds can result in significant performance drop.

     -v   Verbose mode.  Notify of AutoFS mounts, unmounts or other non-
          essential information.

     -r   Remount mode.  Force remounting for all existing AutoFS mount
          points. Without this key autofs remounts only mount points which
          options were changed in /etc/auto_master file. Combination of -r and
          -t keys can be used to change unmount timeout for existing AutoFS
          mount points.

USAGE
   Map Entry Format
     The format for master map entries was discussed above.  Entries in other
     map files take the form:

          key [ -mount-options ] location ...

     where key is the full pathname of the directory to mount when used in a
     direct map, or the simple name of a subdirectory in an indirect map.
     mount-options is a comma-separated list of mount options, and location
     specifies a filesystem from which the directory may be mounted.  In the
     case of a simple NFS mount, location takes the form:

          hostname:pathname

     hostname is the name of the host from which to mount the filesystem (it
     may be omitted if the pathname refers to a local device on which the
     filesystem resides) and pathname is the pathname of the directory to
     mount.  So, /etc/auto_master might contain an entry such as:

          /src  /etc/auto_src           -nosuid

     where /etc/auto_src contains:


          new       awesome:/latest/src
          old   -ro cave:/archive

     Accessing /src/{new,old} would result in a mount of the corresponding
     remote filesystem.

   Replicated Filesystems
     Multiple location fields can be specified for replicated NFS filesystems,
     in which case autofs chooses the server that responds first.

     If each location in the list shares the same pathname then a single
     location may be used with a comma-separated list of hostnames:

          hostname1,hostname2...:pathname

     A mapping can be continued across input lines by escaping the NEWLINE
     with a `\' (backslash).  Comments begin with a '#' (pound sign) and end
     at the subsequent NEWLINE.

   Map Key Substitution"
     The '&' (ampersand) character is expanded to the value of the key field
     for the entry in which it occurs.  In this case:

          whozi onyxserver:/home/&

     the & expands to whozi.

   Wildcard Key
     The '*' (asterisk) character, when supplied as the key field, is
     recognized as the catch-all entry.  Such an entry will match any key not
     previously matched.  For instance, if the following entry appeared in the
     indirect map for /config:

          *    &:/public/config/&

     this would allow automatic mounts in /config of any remote filesystem
     whose location could be specified as:

          hostname:/public/config/hostname

   Variable Substitution
     Client specific variables can be used within an AutoFS map.  For
     instance, if $HOST appeared within a map, autofs would expand it to its
     current value for the client's host name. Supported variables are:

     ARCH      The output of uname -m. The system's architecture.
                                        For example "IP19"

     CPU       The output of uname -p.  The processor type.
                                        For example "mips"


     HOST      The output of uname -n.  The host name.
                                        For example "ferd"

     OSNAME    The output of uname -s.  The OS name.
                                        For example "IRIX"

     OSREL     The output of uname -r.  The OS release name.
                                        For example "6.2"

     OSVERS    The output of uname -v.  The OS version.
                                        For example "10230951"

     If a reference needs to be protected from affixed characters, you can
     surround the variable name with '{}' (curly braces).

   Multiple Mounts
     A multiple mount entry takes the form:

          key [ -mount-options ] [[mountpoint] [-mount-options]
          location...]...

     The initial /[mountpoint] is optional for the first mount and mandatory
     for all subsequent mounts.  The optional mountpoint is taken as a
     pathname relative to the directory named by key. If mountpoint is omitted
     in the first occurrence, a mountpoint of / (root) is implied.

     Given an entry in the indirect map for /src:

          beta -ro \
               /              svr1,svr2:/public/src/beta   \
               /1.0           svr1,svr2:/public/src/beta/1.0   \
               /1.0/man       svr1,svr2:/public/src/beta/1.0/man


     autofs would automatically mount /src/beta, /src/beta/1.0, and
     /src/beta/1.0/man, as needed, from either svr1 or svr2, whichever host
     responds first.

   Other Filesystem Types
     AutoFS assumes NFS Version 3 mounts as the default filesystem type.
     Should the server not support NFS V3, AutoFS will retry the mount(s)
     using the NFS V2 filesystem type.  Users can select a particular version
     of the NFS protocol using the vers={2,3} mount option (see fstab(4)).

     Other filesystem types can be described using the fstype mount option.
     Other mount options specific to this filesystem type can be combined with
     the fstype option.  The location field must contain information specific
     to the filesystem type.  If the location field begins with a slash, a
     colon character must be prepended.


     Mounts using CacheFS are most useful when applied to an entire map as map
     defaults.  The following entry in the master map describes cached home
     directory mounts.  It assumes the default location of the cache
     directory, /cache.

          /home     auto_home -fstype=cachefs,backfstype=nfs


     The backfstype option is required for CacheFS map entries.

     NOTE! Currently the only supported filesystem types which can be used
     with fstype option are nfs, nfs3 and cachefs.

   Indirect Maps
     An indirect map allows you to specify mappings for the subdirectories you
     wish to mount under the directory chosen as the AutoFS mount point.  In
     an indirect map, each key consists of a simple name (i.e., subdirectory)
     that refers to one or more filesystems that are to be mounted as needed.

   Direct Maps
     Entries in a direct map are associated directly with AutoFS mount points.
     Each key is the full pathname of an AutoFS mount point.  The direct map
     as a whole is not associated with any single directory.

   Included Maps
     The contents of another map can be included within either a master map or
     a mount point map with an entry of the form +mapname.  If mapname begins
     with a slash then it is assumed to be the pathname of a local file.
     Otherwise the location of the map is determined by the policy of the name
     service switch according to the entry for the automounter in
     /etc/nsswitch.conf, such as

          automount(dynamic): files nis(nis_enumerate_key) ldap

     If the name service is files then the name is assumed to be that of a
     local file in /etc.  NIS requires the addition of the nis_enumerate_key
     attribute; see nis(7P). If the key being searched for is not found in the
     included map, the search continues with the next entry subject to control
     options. See nsswitch.conf(4).  The dynamic attribute is required to
     notify the Name Service Daemon (nsd) that the automount map allows
     dynamic map creation. See nsd(1M).

   Special Maps
     There are two special maps available: -hosts and -null.  By default, the
     -hosts map is used with the /hosts directory.  It assumes that the map
     key is the hostname of an NFS server.  The autofsd daemon dynamically
     constructs a map entry from the server's list of exported filesystems.
     (See NOTES on -nohide.)  For instance a reference to /hosts/bart/usr
     would initiate an automatic mount of all exported filesystems from bart
     that are mountable by the client.  References to a directory under
     /hosts/bart will refer to the corresponding directory relative to bart's
     root.


     The -null map, when indicated in a map entry, cancels a previous map for
     the directory indicated.  This is most useful in the /etc/auto_master
     file for cancelling entries that would otherwise be inherited from the
     NIS auto_master map, if included. To be effective, the -null entries must
     be inserted before the included map entry.

   Configuration and the auto.master File
     autofs normally consults the /etc/auto_master configuration file for a
     list of initial autofs maps, and sets up automatic mounts for them. This
     behavior differs from automount in that autofs does not take maps on the
     command line, nor does it look at the auto.master NIS map by default.
     Extra mappings (either NIS or file based) should be specified within the
     /etc/auto_master configuration file itself. To default to the automount
     behavior, for backward compatibility with old automount maps, the user
     should have one line in the /etc/auto_master configuration file, pointing
     to the NIS auto.master map of the form:

          +auto.master

FILES
     /etc/auto_master    master AutoFS map.
     /etc/config/autofs.options
                         options and arguments for the autofs command
     /etc/config/autofsd.options
                         options and arguments for the autofsd daemon.

SEE ALSO
     autofsd (1M), chkconfig (1M), exports (4), fstab (4), mount (1M),
     nsd(1M), nsswitch.conf (4)

NOTES
     The -hosts map mounts all of the exported NFS filesystems, for which the
     client has access, from a server. Use the nohide export option on the
     server (see exports(4)) to minimize the number of mounts performed by
     clients. AutoFS will not request a separate mount for a nohide
     filesystem, if the client has access via the parent filesystem.  If
     frequent access to just a single filesystem is required, it is more
     efficient to access the filesystem with a map entry that is tailored to
     mount just the filesystem of interest.

     AutoFS mount points must not be hierarchically related. autofs does not
     allow an AutoFS mount point to be created within another AutoFS mount.

     Since each direct map entry results in a new AutoFS mount such maps
     should be kept short.

     If a directory contains direct map mount points then an `ls -l' in the
     directory will force all of the direct map mounts to occur.

     Entries in both direct and indirect maps can be modified at any time.
     The new information is used when autofsd next uses the map entry to do a
     mount.


     New entries added to a master map or direct map will not be useful until
     the autofs command is run to install them as new AutoFS mount points.
     New entries added to an indirect map may be used immediately.

     An AutoFS directory associated with an indirect map shows only
     currently-mounted entries.  This is a deliberate policy to avoid
     inadvertent mounting of every entry in a map via an `ls -l' of the
     directory.

     The multiple location feature for NFS mounts allows the autofsd daemon to
     choose the most appropriate server at mount time.  While such a mount is
     in effect, the daemon does not monitor the status of the server.  If the
     server crashes, autofsd will not select an alternative server from the
     list.

     Default mount options can be assigned to an entire map when specified as
     an optional third field in the master map.  These options apply only to
     map entries that have no mount options.

     When using NSD to resolve map queries, Autofs actually creates map
     directories under the automount directory in /ns/.local. So, the NIS map
     auto_home would be created as /ns/.local/automount/auto_home


CAVEATS
     It is important not to have the execute permission set on a standard text
     AutoFS map, as this may cause autofs to attempt to execute the file
     assuming that the standard text map file is an executable AutoFS map
     file. Look at the -E option in the autofsd man page for more information
     on executable maps.

     Using autofs maps which allow arbitrary key values, e.g. the -hosts map
     or a map which has wildcard substitution, could lead to abuse from rogue
     local users with potential detrimental effects for stability and security
     of a system.

     Included maps (see section ''Included Maps'') functionality only works if
     the map which includes another map is a local file. Including maps does
     not work from NIS or executable maps.


                                                                        Page 7