p .Ar mountpoint is either a fully specified path, or
a /- . When .Ar mountpoint is a full path, .Ar map_name must reference an indirect map. Otherwise, .Ar map_name must reference a direct map. See .Sx "MAP SYNTAX" below.
p .Ar map_name specifies map to use. If .Ar map_name begins with .Li - , it specifies a special map. See .Sx "MAP SYNTAX" below. If .Ar map_name is not a fully specified path
q it does not start with Li / , .Xr automountd 8 will search for that name in
a /etc . Otherwise it will use the path as given. If the file indicated by .Ar map_name is executable, .Xr automountd 8 will assume it is an executable map. See .Sx "MAP SYNTAX" below. Otherwise, the file is opened and the contents parsed.
p .Op Fl Ar options is an optional field that starts with .Fl and can contain generic file system mount options.
p The following example specifies that the
a /etc/auto_example indirect map will be mounted on
a /example . d -literal -offset indent /example auto_example .Ed .Sh MAP SYNTAX Map files consist of lines with a number of entries separated by whitespace and terminated by newline character: d -literal -offset indent .Ar key Oo Fl Ar options Oc Oo Ar mountpoint Oo Fl Ar options Oc Oc Ar location Op ... .Ed
p In most cases, it can be simplified to: d -literal -offset indent .Ar key Oo Fl Ar options Oc Ar location .Ed
p .Ar key is the path component used by .Xr automountd 8 to find the right map entry to use. It is also used to form the final mountpoint. A wildcard
q Ql * can be used for the key. It matches every directory that does not match other keys. Those directories will not be visible to the user until accessed.
p The .Ar options field, if present, must begin with .Fl . When mounting the file system, options supplied to .Nm and options specified in the map entry are concatenated together. The special option c fstype is used to specify file system type. It is not passed to the mount program as an option. Instead, it is passed as an argument to .Cm "mount -t". The default c fstype is .Ql nfs . The special option c nobrowse is used to disable creation of top-level directories for special and executable maps.
p The optional .Ar mountpoint field is used to specify multiple mount points for a single key.
p The .Ar location field specifies the file system to be mounted. Ampersands
q Ql & in the .Ar location field are replaced with the value of .Ar key . This is typically used with wildcards, like: d -literal -offset indent * 192.168.1.1:/share/& .Ed
p The .Ar location field may contain references to variables, like: d -literal -offset indent sys 192.168.1.1:/sys/${OSNAME} .Ed
p Defined variables are:
p l -tag -width "Dv OSNAME" -compact t Dv ARCH Expands to the output of .Li "uname -p" . t Dv CPU Same as .Dv ARCH . t Dv DOLLAR A literal $ sign. t Dv HOST Expands to the output of .Li "uname -n" . t Dv OSNAME Expands to the output of .Li "uname -s" . t Dv OSREL Expands to the output of .Li "uname -r" . t Dv OSVERS Expands to the output of .Li "uname -v" . .El
p Additional variables can be defined with the .Fl D option of .Xr automount 8 and .Xr automountd 8 .
p To pass a location that begins with
a / , prefix it with a colon. For example, .Li :/dev/cd0 .
p This example, when put into
a /etc/auto_example , and with .Nm referring to the map as described above, specifies that the NFS share .Li 192.168.1.1:/share/example/x will be mounted on
a /example/x/ when any process attempts to access that mountpoint, with c intr and c nfsv4 mount options, described in .Xr mount_nfs 8 : d -literal -offset indent x -intr,nfsv4 192.168.1.1:/share/example/x .Ed
p Automatically mount an SMB share on access, as a guest user, without prompting for a password: d -literal -offset indent share -fstype=smbfs,-N ://@server/share .Ed
p Automatically mount the CD drive on access: d -literal -offset indent cd -fstype=cd9660 :/dev/cd0 .Ed .Sh SPECIAL MAPS Special maps have names beginning with .Li - . Supported special maps are:
p l -tag -width ".Ic -noauto" -compact t Ic -hosts Query the remote NFS server and map exported shares. This map is traditionally mounted on
a /net . Access to files on a remote NFS server is provided through the
a /net/ Ns Ar nfs-server-ip Ns / Ns Ar share-name Ns / directory without any additional configuration. Directories for individual NFS servers are not present until the first access, when they are automatically created. t Ic -media Query devices that are not yet mounted, but contain valid file systems. Generally used to access files on removable media. t Ic -noauto Mount file systems configured in .Xr fstab 5 as "noauto". This needs to be set up as a direct map. t Ic -null Prevent .Xr automountd 8 from mounting anything on the mountpoint. .El
p It is possible to add custom special maps by adding them, as executable maps named
a special_foo , to the
a /etc/autofs/ directory. .Sh EXECUTABLE MAPS If the map file specified in .Nm has the execute bit set, .Xr automountd 8 will execute it and parse the standard output instead of parsing the file contents. When called without command line arguments, the executable is expected to output a list of available map keys separated by newline characters. Otherwise, the executable will be called with a key name as a command line argument. Output from the executable is expected to be the entry for that key, not including the key itself. .Sh INDIRECT VERSUS DIRECT MAPS Indirect maps are referred to in .Nm by entries with a fully qualified path as a mount point, and must contain only relative paths as keys. Direct maps are referred to in .Nm by entries with .Li /- as the mountpoint, and must contain only fully qualified paths as keys. For indirect maps, the final mount point is determined by concatenating the .Nm mountpoint with the map entry key and optional map entry mountpoint. For direct maps, the final mount point is determined by concatenating the map entry key with the optional map entry mountpoint.
p The example above could be rewritten using direct map, by placing this in .Nm : d -literal -offset indent /- auto_example .Ed
p and this in the
a /etc/auto_example map file: d -literal -offset indent /example/x -intr,nfsv4 192.168.1.1:/share/example/x /example/share -fstype=smbfs,-N ://@server/share /example/cd -fstype=cd9660 :/dev/cd0 .Ed .Sh DIRECTORY SERVICES Both .Nm and maps may contain entries consisting of a plus sign and map name: d -literal -offset indent +auto_master .Ed
p Those entries cause .Xr automountd 8 daemon to retrieve the named map from directory services (like LDAP) and include it where the entry was.
p If the file containing the map referenced in .Nm is not found, the map will be retrieved from directory services instead.
p To retrieve entries from directory services, .Xr automountd 8 daemon runs
a /etc/autofs/include , which is usually a shell script, with map name as the only command line parameter. The script should output entries formatted according to .Nm or automounter map syntax to standard output. An example script to use LDAP is included in
a /etc/autofs/include_ldap . It can be symlinked to
a /etc/autofs/include . .Sh FILES l -tag -width ".Pa /etc/auto_master" -compact t Pa /etc/auto_master The default location of the .Nm file. t Pa /etc/autofs/ Directory containing shell scripts to implement special maps and directory services. .El .Sh SEE ALSO .Xr autofs 5 , .Xr automount 8 , .Xr automountd 8 , .Xr autounmountd 8 .Sh AUTHORS .An -nosplit The .Nm configuration file functionality was developed by .An Edward Tomasz Napierala Aq Mt trasz (at] FreeBSD.org under sponsorship from the .Fx Foundation.
p The .Nm configuration file functionality was ported to .Dx and .Nx by .An Tomohiro Kusumi Aq Mt tkusumi (at] netbsd.org . .Sh BUGS The .Li -media special map is currently unsupported on .Nx .