1 .\" Copyright (c) 2014 The FreeBSD Foundation
3 .\" This software was developed by Edward Tomasz Napierala under sponsorship
4 .\" from the FreeBSD Foundation.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
15 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
16 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
19 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 .Nd auto_master and map file format
36 The automounter configuration consists of the
38 configuration file, which assigns filesystem paths to map names,
39 and maps, which contain actual mount information.
42 configuration file is used by the
45 Map files are read by the
48 .Sh AUTO_MASTER SYNTAX
51 file consists of lines with two or three entries separated by whitespace
52 and terminated by newline character:
53 .Bd -literal -offset indent
54 .Pa mountpoint Pa map_name Op Ar -options
58 is either a fully specified path, or
64 must reference an indirect map.
67 must reference a direct map.
69 .Sx "MAP SYNTAX" below.
77 it specifies a special map.
83 is not a fully specified path
84 .Pq it does not start with Li / ,
86 will search for that name in
88 Otherwise it will use the path as given.
89 If the file indicated by
93 will assume it is an executable map.
97 Otherwise, the file is opened and the contents parsed.
100 is an optional field that starts with
102 and can contain generic filesystem mount options.
104 The following example specifies that the /etc/auto_example indirect map
105 will be mounted on /example.
106 .Bd -literal -offset indent
107 /example auto_example
110 Map files consist of lines with a number of entries separated by whitespace
111 and terminated by newline character:
112 .Bd -literal -offset indent
113 .Pa key Oo Ar -options Oc Oo Ar mountpoint Oo -options Oc Oc Ar location Op ...
116 In most cases, it can be simplified to:
117 .Bd -literal -offset indent
118 .Pa key Oo Ar -options Oc Ar location
122 is the path component used by
124 to find the right map entry to use.
125 It is also used to form the final mountpoint.
128 can be used for the key.
129 It matches every directory that does not match other keys.
130 Those directories will not be visible to the user
135 field, if present, must begin with
137 When mounting the filesystem, options supplied to
139 and options specified in the map entry are concatenated together.
142 is used to specify filesystem type.
143 It is not passed to the mount program as an option.
144 Instead, it is passed as an argument to
152 is used to disable creation of top-level directories for special
157 field is used to specify multiple mount points
162 field specifies the filesystem to be mounted.
167 field are replaced with the value of
169 This is typically used with wildcards, like:
170 .Bd -literal -offset indent
171 .Li * 192.168.1.1:/share/&
176 field may contain references to variables, like:
177 .Bd -literal -offset indent
178 .Li sys 192.168.1.1:/sys/${OSNAME}
181 Defined variables are:
183 .Bl -tag -width "-OSNAME" -compact
185 Expands to the output of
192 Expands to the output of
195 Expands to the output of
198 Expands to the output of
201 Expands to the output of
205 Additional variables can be defined with the
212 To pass a location that begins with
214 prefix it with a colon.
218 This example, when put into
219 .Pa /etc/auto_example ,
222 referring to the map as described above, specifies that the NFS share
223 .Li 192.168.1.1:/share/example/x
226 when any process attempts to access that mountpoint, with
230 mount options, described in
232 .Bd -literal -offset indent
233 .Li x -intr,nfsv4 192.168.1.1:/share/example/x
236 Automatically mount an SMB share on access, as a guest user,
237 without prompting for a password:
238 .Bd -literal -offset indent
239 .Li share -fstype=smbfs,-N ://@server/share
242 Automatically mount the CD drive on access:
243 .Bd -literal -offset indent
244 .Li cd -fstype=cd9660 :/dev/cd0
247 Special maps have names beginning with
249 Supported special maps are:
251 .Bl -tag -width "-hosts" -compact
253 Query the remote NFS server and map exported shares.
254 This map is traditionally mounted on
256 Access to files on a remote NFS server is provided through the
257 .Pf /net/ Ar nfs-server-ip Ns / Ns Ar share-name Ns /
258 directory without any additional configuration.
259 Directories for individual NFS servers are not present until the first access,
260 when they are automatically created.
262 Query devices that are not yet mounted, but contain valid filesystems.
263 Generally used to access files on removable media.
265 Mount filesystems configured in
268 This needs to be set up as a direct map.
272 from mounting anything on the mountpoint.
275 It is possible to add custom special maps by adding them, as executable
282 If the map file specified in
284 has the execute bit set,
286 will execute it and parse the standard output instead of parsing
288 When called without command line arguments, the executable is
289 expected to output a list of available map keys separated by
291 Otherwise, the executable will be called with a key name as
292 a command line argument.
293 Output from the executable is expected to be the entry for that key,
294 not including the key itself.
295 .Sh INDIRECT VERSUS DIRECT MAPS
296 Indirect maps are referred to in
298 by entries with a fully qualified path as a mount point, and must contain only
299 relative paths as keys.
300 Direct maps are referred to in
304 as the mountpoint, and must contain only fully qualified paths as keys.
305 For indirect maps, the final mount point is determined by concatenating the
307 mountpoint with the map entry key and optional map entry mountpoint.
308 For direct maps, the final mount point is determined by concatenating
309 the map entry key with the optional map entry mountpoint.
311 The example above could be rewritten using direct map, by placing this in
313 .Bd -literal -offset indent
318 .Li /etc/auto_example
320 .Bd -literal -offset indent
321 .Li /example/x -intr,nfsv4 192.168.1.1:/share/example/x
322 .Li /example/share -fstype=smbfs,-N ://@server/share
323 .Li /example/cd -fstype=cd9660 :/dev/cd0
325 .Sh DIRECTORY SERVICES
328 and maps may contain entries consisting of a plus sign and map name:
329 .Bd -literal -offset indent
335 daemon to retrieve the named map from directory services (like LDAP)
336 and include it where the entry was.
338 If the file containing the map referenced in
340 is not found, the map will be retrieved from directory services instead.
342 To retrieve entries from directory services,
345 .Pa /etc/autofs/include ,
346 which is usually a shell script, with map name as the only command line
348 The script should output entries formatted according to
350 or automounter map syntax to standard output.
351 An example script to use LDAP is included in
352 .Pa /etc/autofs/include_ldap .
353 It can be symlinked to
354 .Pa /etc/autofs/include .
356 .Bl -tag -width ".Pa /etc/auto_master" -compact
357 .It Pa /etc/auto_master
358 The default location of the
362 Directory containing shell scripts to implement special maps and directory
373 configuration file functionality was developed by
374 .An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org
375 under sponsorship from the FreeBSD Foundation.