1.\" Copyright (c) 2014 The FreeBSD Foundation 2.\" All rights reserved. 3.\" 4.\" This software was developed by Edward Tomasz Napierala under sponsorship 5.\" from the FreeBSD Foundation. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 1. Redistributions of source code must retain the above copyright 11.\" notice, this list of conditions and the following disclaimer. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice, this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 16.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE 20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26.\" SUCH DAMAGE. 27.\" 28.\" $FreeBSD$ 29.\" 30.Dd November 21, 2014 31.Dt AUTO_MASTER 5 32.Os 33.Sh NAME 34.Nm auto_master 35.Nd auto_master and map file format 36.Sh DESCRIPTION 37The automounter configuration consists of the 38.Nm 39configuration file, which assigns filesystem paths to map names, 40and maps, which contain actual mount information. 41The 42.Nm 43configuration file is used by the 44.Xr automount 8 45command. 46Map files are read by the 47.Xr automountd 8 48daemon. 49.Sh AUTO_MASTER SYNTAX 50The 51.Nm 52file consists of lines with two or three entries separated by whitespace 53and terminated by newline character: 54.Bd -literal -offset indent 55.Pa mountpoint Pa map_name Op Ar -options 56.Ed 57.Pp 58.Pa mountpoint 59is either a fully specified path, or 60.Li /- . 61When 62.Pa mountpoint 63is a full path, 64.Pa map_name 65must reference an indirect map. 66Otherwise, 67.Pa map_name 68must reference a direct map. 69See 70.Sx "MAP SYNTAX" below. 71.Pp 72.Pa map_name 73specifies map to use. 74If 75.Pa map_name 76begins with 77.Li - , 78it specifies a special map. 79See 80.Sx "MAP SYNTAX" 81below. 82If 83.Pa map_name 84is not a fully specified path 85.Pq it does not start with Li / , 86.Xr automountd 8 87will search for that name in 88.Li /etc . 89Otherwise it will use the path as given. 90If the file indicated by 91.Pa map_name 92is executable, 93.Xr automountd 8 94will assume it is an executable map. 95See 96.Sx "MAP SYNTAX" 97below. 98Otherwise, the file is opened and the contents parsed. 99.Pp 100.Pa -options 101is an optional field that starts with 102.Li - 103and can contain generic filesystem mount options. 104.Pp 105The following example specifies that the /etc/auto_example indirect map 106will be mounted on /example. 107.Bd -literal -offset indent 108/example auto_example 109.Ed 110.Sh MAP SYNTAX 111Map files consist of lines with a number of entries separated by whitespace 112and terminated by newline character: 113.Bd -literal -offset indent 114.Pa key Oo Ar -options Oc Oo Ar mountpoint Oo -options Oc Oc Ar location Op ... 115.Ed 116.Pp 117In most cases, it can be simplified to: 118.Bd -literal -offset indent 119.Pa key Oo Ar -options Oc Ar location 120.Ed 121.Pp 122.Pa key 123is the path component used by 124.Xr automountd 8 125to find the right map entry to use. 126It is also used to form the final mountpoint. 127A wildcard 128.Pq Ql * 129can be used for the key. 130It matches every directory that does not match other keys. 131Those directories will not be visible to the user 132until accessed. 133.Pp 134The 135.Ar options 136field, if present, must begin with 137.Li - . 138When mounting the filesystem, options supplied to 139.Nm 140and options specified in the map entry are concatenated together. 141The special option 142.Li fstype 143is used to specify filesystem type. 144It is not passed to the mount program as an option. 145Instead, it is passed as an argument to 146.Cm "mount -t". 147The default 148.Li fstype 149is 150.Ql nfs . 151The special option 152.Li nobrowse 153is used to disable creation of top-level directories for special 154and executable maps. 155.Pp 156The optional 157.Pa mountpoint 158field is used to specify multiple mount points 159for a single key. 160.Pp 161The 162.Ar location 163field specifies the filesystem to be mounted. 164Ampersands 165.Pq Ql & 166in the 167.Ar location 168field are replaced with the value of 169.Ar key . 170This is typically used with wildcards, like: 171.Bd -literal -offset indent 172.Li * 192.168.1.1:/share/& 173.Ed 174.Pp 175To pass a location that begins with 176.Li / , 177prefix it with a colon. 178For example, 179.Li :/dev/cd0 . 180.Pp 181This example, when put into 182.Pa /etc/auto_example , 183and with 184.Nm 185referring to the map as described above, specifies that the NFS share 186.Li 192.168.1.1:/share/example/x 187will be mounted on 188.Pa /example/x/ 189when any process attempts to access that mountpoint, with 190.Li intr 191and 192.Li nfsv4 193mount options, described in 194.Xr mount_nfs 8 : 195.Bd -literal -offset indent 196.Li x -intr,nfsv4 192.168.1.1:/share/example/x 197.Ed 198.Pp 199Automatically mount an SMB share on access, as a guest user, 200without prompting for a password: 201.Bd -literal -offset indent 202.Li share -fstype=smbfs,-N ://@server/share 203.Ed 204.Pp 205Automatically mount the CD drive on access: 206.Bd -literal -offset indent 207.Li cd -fstype=cd9660 :/dev/cd0 208.Ed 209.Sh SPECIAL MAPS 210Special maps have names beginning with 211.Li - . 212Supported special maps are: 213.Pp 214.Bl -tag -width "-hosts" -compact 215.It Li -hosts 216This map queries the remote NFS server and maps exported volumes. 217It is traditionally mounted on 218.Pa /net . 219It enables access to files on a remote NFS server by accessing 220.Pa /net/nfs-server-ip/share-name/ 221directory, without the need for any further configuration. 222.It Li -null 223This map prevents the 224.Xr automountd 8 225from mounting anything on the mountpoint. 226.El 227.Sh EXECUTABLE MAPS 228If the map file specified in 229.Nm 230has execute bit set, the 231.Xr automountd 8 232will execute it and parse the standard output instead of parsing 233the file contents. 234.Sh INDIRECT VERSUS DIRECT MAPS 235Indirect maps are referred to in 236.Nm 237by entries with a fully qualified path as a mount point, and must contain only 238relative paths as keys. 239Direct maps are referred to in 240.Nm 241by entries with 242.Li /- 243as the mountpoint, and must contain only fully qualified paths as keys. 244For indirect maps, the final mount point is determined by concatenating the 245.Nm 246mountpoint with the map entry key and optional map entry mountpoint. 247For direct maps, the final mount point is determined by concatenating 248the map entry key with the optional map entry mountpoint. 249.Pp 250The example above could be rewritten using direct map, by placing this in 251.Nm : 252.Bd -literal -offset indent 253.Li /- auto_example 254.Ed 255.Pp 256and this in 257.Li /etc/auto_example 258map file: 259.Bd -literal -offset indent 260.Li /example/x -intr,nfsv4 192.168.1.1:/share/example/x 261.Li /example/share -fstype=smbfs,-N ://@server/share 262.Li /example/cd -fstype=cd9660 :/dev/cd0 263.Ed 264.Sh DIRECTORY SERVICES 265Both 266.Nm 267and maps may contain entries consisting of a plus sign and map name: 268.Bd -literal -offset indent 269.Li +auto_master 270.Ed 271.Pp 272Those entries cause 273.Xr automountd 8 274daemon to retrieve the named map from directory services (like LDAP) 275and include it where the entry was. 276.Pp 277If the file containing the map referenced in 278.Nm 279is not found, the map will be retrieved from directory services instead. 280.Pp 281To retrieve entries from directory services, 282.Xr automountd 8 283daemon runs 284.Pa /etc/autofs/include , 285which is usually a shell script, with map name as the only command line 286parameter. 287The script should output entries formatted according to 288.Nm 289or automounter map syntax to standard output. 290An example script to use LDAP is included in 291.Pa /etc/autofs/include_ldap . 292It can be symlinked to 293.Pa /etc/autofs/include . 294.Sh FILES 295.Bl -tag -width ".Pa /etc/auto_master" -compact 296.It Pa /etc/auto_master 297The default location of the 298.Pa auto_master 299file. 300.El 301.Sh SEE ALSO 302.Xr autofs 5 , 303.Xr automount 8 , 304.Xr automountd 8 , 305.Xr autounmountd 8 306.Sh AUTHORS 307The 308.Nm 309configuration file functionality was developed by 310.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org 311under sponsorship from the FreeBSD Foundation. 312