1 .\" Copyright (c) 2014 The FreeBSD Foundation
2 .\" All rights reserved.
4 .\" This software was developed by Edward Tomasz Napierala under sponsorship
5 .\" from the FreeBSD Foundation.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
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.
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
35 .Nd auto_master and map file format
37 The automounter configuration consists of the
39 configuration file, which assigns filesystem paths to map names,
40 and maps, which contain actual mount information.
43 configuration file is used by the
46 Map files are read by the
49 .Sh AUTO_MASTER SYNTAX
52 file consists of lines with two or three entries separated by whitespace
53 and terminated by newline character:
54 .Bd -literal -offset indent
55 .Pa mountpoint Pa map_name Op Ar -options
59 is either a fully specified path, or
65 must reference an indirect map.
68 must reference a direct map.
70 .Sx "MAP SYNTAX" below.
78 it specifies a special map.
84 is not a fully specified path
85 .Pq it does not start with Li / ,
87 will search for that name in
89 Otherwise it will use the path as given.
90 If the file indicated by
94 will assume it is an executable map.
98 Otherwise, the file is opened and the contents parsed.
101 is an optional field that starts with
103 and can contain generic filesystem mount options.
105 The following example specifies that the /etc/auto_example indirect map
106 will be mounted on /example.
107 .Bd -literal -offset indent
108 /example auto_example
111 Map files consist of lines with a number of entries separated by whitespace
112 and 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 ...
117 In most cases, it can be simplified to:
118 .Bd -literal -offset indent
119 .Pa key Oo Ar -options Oc Ar location
123 is the path component used by
125 to find the right map entry to use.
126 It is also used to form the final mountpoint.
129 can be used for the key.
130 It matches every directory that does not match other keys.
131 Those directories will not be visible to the user
136 field, if present, must begin with
138 When mounting the filesystem, options supplied to
140 and options specified in the map entry are concatenated together.
143 is used to specify filesystem type.
144 It is not passed to the mount program as an option.
145 Instead, it is passed as an argument to
153 is used to disable creation of top-level directories for special
158 field is used to specify multiple mount points
163 field specifies the filesystem to be mounted.
168 field are replaced with the value of
170 This is typically used with wildcards, like:
171 .Bd -literal -offset indent
172 .Li * 192.168.1.1:/share/&
177 field may contain references to variables, like:
178 .Bd -literal -offset indent
179 .Li sys 192.168.1.1:/sys/${OSNAME}
182 Defined variables are:
184 .Bl -tag -width "-OSNAME" -compact
186 Expands to the output of
191 Expands to the output of
194 Expands to the output of
197 Expands to the output of
200 Expands to the output of
204 Additional variables can be defined with the
211 To pass a location that begins with
213 prefix it with a colon.
217 This example, when put into
218 .Pa /etc/auto_example ,
221 referring to the map as described above, specifies that the NFS share
222 .Li 192.168.1.1:/share/example/x
225 when any process attempts to access that mountpoint, with
229 mount options, described in
231 .Bd -literal -offset indent
232 .Li x -intr,nfsv4 192.168.1.1:/share/example/x
235 Automatically mount an SMB share on access, as a guest user,
236 without prompting for a password:
237 .Bd -literal -offset indent
238 .Li share -fstype=smbfs,-N ://@server/share
241 Automatically mount the CD drive on access:
242 .Bd -literal -offset indent
243 .Li cd -fstype=cd9660 :/dev/cd0
246 Special maps have names beginning with
248 Supported special maps are:
250 .Bl -tag -width "-hosts" -compact
252 Query the remote NFS server and map exported shares.
253 This map is traditionally mounted on
255 Access to files on a remote NFS server is provided through the
256 .Pf /net/ Ar nfs-server-ip Ns / Ns Ar share-name Ns/
257 directory without any additional configuration.
258 Directories for individual NFS servers are not present until the first access,
259 when they are automatically created.
261 Query devices that are not yet mounted, but contain valid filesystems.
262 Generally used to access files on removable media.
266 from mounting anything on the mountpoint.
269 It is possible to add custom special maps by adding them, as executable
276 If the map file specified in
278 has the execute bit set,
280 will execute it and parse the standard output instead of parsing
282 When called without command line arguments, the executable is
283 expected to output a list of available map keys separated by
285 Otherwise, the executable will be called with a key name as
286 a command line argument.
287 Output from the executable is expected to be the entry for that key,
288 not including the key itself.
289 .Sh INDIRECT VERSUS DIRECT MAPS
290 Indirect maps are referred to in
292 by entries with a fully qualified path as a mount point, and must contain only
293 relative paths as keys.
294 Direct maps are referred to in
298 as the mountpoint, and must contain only fully qualified paths as keys.
299 For indirect maps, the final mount point is determined by concatenating the
301 mountpoint with the map entry key and optional map entry mountpoint.
302 For direct maps, the final mount point is determined by concatenating
303 the map entry key with the optional map entry mountpoint.
305 The example above could be rewritten using direct map, by placing this in
307 .Bd -literal -offset indent
312 .Li /etc/auto_example
314 .Bd -literal -offset indent
315 .Li /example/x -intr,nfsv4 192.168.1.1:/share/example/x
316 .Li /example/share -fstype=smbfs,-N ://@server/share
317 .Li /example/cd -fstype=cd9660 :/dev/cd0
319 .Sh DIRECTORY SERVICES
322 and maps may contain entries consisting of a plus sign and map name:
323 .Bd -literal -offset indent
329 daemon to retrieve the named map from directory services (like LDAP)
330 and include it where the entry was.
332 If the file containing the map referenced in
334 is not found, the map will be retrieved from directory services instead.
336 To retrieve entries from directory services,
339 .Pa /etc/autofs/include ,
340 which is usually a shell script, with map name as the only command line
342 The script should output entries formatted according to
344 or automounter map syntax to standard output.
345 An example script to use LDAP is included in
346 .Pa /etc/autofs/include_ldap .
347 It can be symlinked to
348 .Pa /etc/autofs/include .
350 .Bl -tag -width ".Pa /etc/auto_master" -compact
351 .It Pa /etc/auto_master
352 The default location of the
356 Directory containing shell scripts to implement special maps and directory
367 configuration file functionality was developed by
368 .An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org
369 under sponsorship from the FreeBSD Foundation.