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
32 .Nd auto_master and map file format
34 The automounter configuration consists of the
36 configuration file, which assigns filesystem paths to map names,
37 and maps, which contain actual mount information.
40 configuration file is used by the
43 Map files are read by the
46 .Sh AUTO_MASTER SYNTAX
49 file consists of lines with two or three entries separated by whitespace
50 and terminated by newline character:
51 .Bd -literal -offset indent
52 .Pa mountpoint Pa map_name Op Ar -options
56 is either a fully specified path, or
62 must reference an indirect map.
65 must reference a direct map.
67 .Sx "MAP SYNTAX" below.
75 it specifies a special map.
81 is not a fully specified path
82 .Pq it does not start with Li / ,
84 will search for that name in
86 Otherwise it will use the path as given.
87 If the file indicated by
91 will assume it is an executable map.
95 Otherwise, the file is opened and the contents parsed.
98 is an optional field that starts with
100 and can contain generic filesystem mount options.
102 The following example specifies that the /etc/auto_example indirect map
103 will be mounted on /example.
104 .Bd -literal -offset indent
105 /example auto_example
108 Map files consist of lines with a number of entries separated by whitespace
109 and terminated by newline character:
110 .Bd -literal -offset indent
111 .Pa key Oo Ar -options Oc Oo Ar mountpoint Oo -options Oc Oc Ar location Op ...
114 In most cases, it can be simplified to:
115 .Bd -literal -offset indent
116 .Pa key Oo Ar -options Oc Ar location
120 is the path component used by
122 to find the right map entry to use.
123 It is also used to form the final mountpoint.
126 can be used for the key.
127 It matches every directory that does not match other keys.
128 Those directories will not be visible to the user
133 field, if present, must begin with
135 When mounting the filesystem, options supplied to
137 and options specified in the map entry are concatenated together.
140 is used to specify filesystem type.
141 It is not passed to the mount program as an option.
142 Instead, it is passed as an argument to
150 is used to disable creation of top-level directories for special
155 field is used to specify multiple mount points
160 field specifies the filesystem to be mounted.
165 field are replaced with the value of
167 This is typically used with wildcards, like:
168 .Bd -literal -offset indent
169 .Li * 192.168.1.1:/share/&
174 field may contain references to variables, like:
175 .Bd -literal -offset indent
176 .Li sys 192.168.1.1:/sys/${OSNAME}
179 Defined variables are:
181 .Bl -tag -width "-OSNAME" -compact
183 Expands to the output of
190 Expands to the output of
193 Expands to the output of
196 Expands to the output of
199 Expands to the output of
203 Additional variables can be defined with the
210 To pass a location that begins with
212 prefix it with a colon.
216 This example, when put into
217 .Pa /etc/auto_example ,
220 referring to the map as described above, specifies that the NFS share
221 .Li 192.168.1.1:/share/example/x
224 when any process attempts to access that mountpoint, with
228 mount options, described in
230 .Bd -literal -offset indent
231 .Li x -intr,nfsv4 192.168.1.1:/share/example/x
234 Automatically mount an SMB share on access, as a guest user,
235 without prompting for a password:
236 .Bd -literal -offset indent
237 .Li share -fstype=smbfs,-N ://@server/share
240 Automatically mount the CD drive on access:
241 .Bd -literal -offset indent
242 .Li cd -fstype=cd9660 :/dev/cd0
245 Special maps have names beginning with
247 Supported special maps are:
249 .Bl -tag -width "-hosts" -compact
251 Query the remote NFS server and map exported shares.
252 This map is traditionally mounted on
254 Access to files on a remote NFS server is provided through the
255 .Pf /net/ Ar nfs-server-ip Ns / Ns Ar share-name Ns /
256 directory without any additional configuration.
257 Directories for individual NFS servers are not present until the first access,
258 when they are automatically created.
260 Query devices that are not yet mounted, but contain valid filesystems.
261 Generally used to access files on removable media.
263 Mount filesystems configured in
266 This needs to be set up as a direct map.
270 from mounting anything on the mountpoint.
273 It is possible to add custom special maps by adding them, as executable
280 If the map file specified in
282 has the execute bit set,
284 will execute it and parse the standard output instead of parsing
286 When called without command line arguments, the executable is
287 expected to output a list of available map keys separated by
289 Otherwise, the executable will be called with a key name as
290 a command line argument.
291 Output from the executable is expected to be the entry for that key,
292 not including the key itself.
293 .Sh INDIRECT VERSUS DIRECT MAPS
294 Indirect maps are referred to in
296 by entries with a fully qualified path as a mount point, and must contain only
297 relative paths as keys.
298 Direct maps are referred to in
302 as the mountpoint, and must contain only fully qualified paths as keys.
303 For indirect maps, the final mount point is determined by concatenating the
305 mountpoint with the map entry key and optional map entry mountpoint.
306 For direct maps, the final mount point is determined by concatenating
307 the map entry key with the optional map entry mountpoint.
309 The example above could be rewritten using direct map, by placing this in
311 .Bd -literal -offset indent
316 .Li /etc/auto_example
318 .Bd -literal -offset indent
319 .Li /example/x -intr,nfsv4 192.168.1.1:/share/example/x
320 .Li /example/share -fstype=smbfs,-N ://@server/share
321 .Li /example/cd -fstype=cd9660 :/dev/cd0
323 .Sh DIRECTORY SERVICES
326 and maps may contain entries consisting of a plus sign and map name:
327 .Bd -literal -offset indent
333 daemon to retrieve the named map from directory services (like LDAP)
334 and include it where the entry was.
336 If the file containing the map referenced in
338 is not found, the map will be retrieved from directory services instead.
340 To retrieve entries from directory services,
343 .Pa /etc/autofs/include ,
344 which is usually a shell script, with map name as the only command line
346 The script should output entries formatted according to
348 or automounter map syntax to standard output.
349 An example script to use LDAP is included in
350 .Pa /etc/autofs/include_ldap .
351 It can be symlinked to
352 .Pa /etc/autofs/include .
354 .Bl -tag -width ".Pa /etc/auto_master" -compact
355 .It Pa /etc/auto_master
356 The default location of the
360 Directory containing shell scripts to implement special maps and directory
371 configuration file functionality was developed by
372 .An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org
373 under sponsorship from the FreeBSD Foundation.