1 .\" Copyright (c) 2016 The DragonFly Project
2 .\" Copyright (c) 2014 The FreeBSD Foundation
3 .\" All rights reserved.
5 .\" This software was developed by Edward Tomasz Napierala under sponsorship
6 .\" from the FreeBSD Foundation.
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\" notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\" notice, this list of conditions and the following disclaimer in the
15 .\" documentation and/or other materials provided with the distribution.
17 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
18 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
21 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 .Nd auto_master and map file format
38 The automounter configuration consists of the
40 configuration file, which assigns filesystem paths to map names,
41 and maps, which contain actual mount information.
44 configuration file is used by the
47 Map files are read by the
50 .Sh AUTO_MASTER SYNTAX
53 file consists of lines with two or three entries separated by whitespace
54 and terminated by newline character:
55 .Bd -literal -offset indent
56 .Pa mountpoint Pa map_name Op Ar -options
60 is either a fully specified path, or
66 must reference an indirect map.
69 must reference a direct map.
80 it specifies a special map.
86 is not a fully specified path
87 .Pq it does not start with Li / ,
89 will search for that name in
91 Otherwise it will use the path as given.
92 If the file indicated by
96 will assume it is an executable map.
100 Otherwise, the file is opened and the contents parsed.
103 is an optional field that starts with
105 and can contain generic filesystem mount options.
107 The following example specifies that the /etc/auto_example indirect map
108 will be mounted on /example.
109 .Bd -literal -offset indent
110 /example auto_example
113 Map files consist of lines with a number of entries separated by whitespace
114 and terminated by newline character:
115 .Bd -literal -offset indent
116 .Pa key Oo Ar -options Oc Oo Ar mountpoint Oo -options Oc Oc Ar location Op ...
119 In most cases, it can be simplified to:
120 .Bd -literal -offset indent
121 .Pa key Oo Ar -options Oc Ar location
125 is the path component used by
127 to find the right map entry to use.
128 It is also used to form the final mountpoint.
131 can be used for the key.
132 It matches every directory that does not match other keys.
133 Those directories will not be visible to the user
138 field, if present, must begin with
140 When mounting the filesystem, options supplied to
142 and options specified in the map entry are concatenated together.
145 is used to specify filesystem type.
146 It is not passed to the mount program as an option.
147 Instead, it is passed as an argument to
155 is used to disable creation of top-level directories for special
160 field is used to specify multiple mount points
165 field specifies the filesystem to be mounted.
170 field are replaced with the value of
172 This is typically used with wildcards, like:
173 .Bd -literal -offset indent
174 .Li * 192.168.1.1:/share/&
179 field may contain references to variables, like:
180 .Bd -literal -offset indent
181 .Li sys 192.168.1.1:/sys/${OSNAME}
184 Defined variables are:
186 .Bl -tag -width "-OSNAME" -compact
188 Expands to the output of
193 Expands to the output of
196 Expands to the output of
199 Expands to the output of
202 Expands to the output of
206 Additional variables can be defined with the
213 To pass a location that begins with
215 prefix it with a colon.
219 This example, when put into
220 .Pa /etc/auto_example ,
223 referring to the map as described above, specifies that the NFS share
224 .Li 192.168.1.1:/share/example/x
227 when any process attempts to access that mountpoint, with
231 mount options, described in
233 .Bd -literal -offset indent
234 .Li x -intr,nfsv4 192.168.1.1:/share/example/x
237 Automatically mount an SMB share on access, as a guest user,
238 without prompting for a password:
239 .Bd -literal -offset indent
240 .Li share -fstype=smbfs,-N ://@server/share
243 Automatically mount the CD drive on access:
244 .Bd -literal -offset indent
245 .Li cd -fstype=cd9660 :/dev/cd0
248 Special maps have names beginning with
250 Supported special maps are:
252 .Bl -tag -width "-hosts" -compact
254 Query the remote NFS server and map exported shares.
255 This map is traditionally mounted on
257 Access to files on a remote NFS server is provided through the
258 .Pf /net/ Ar nfs-server-ip Ns / Ns Ar share-name Ns/
259 directory without any additional configuration.
260 Directories for individual NFS servers are not present until the first access,
261 when they are automatically created.
263 Query devices that are not yet mounted, but contain valid filesystems.
264 Generally used to access files on removable media.
266 Mount filesystems configured in
269 This needs to be set up as a direct map.
273 from mounting anything on the mountpoint.
276 It is possible to add custom special maps by adding them, as executable
283 If the map file specified in
285 has the execute bit set,
287 will execute it and parse the standard output instead of parsing
289 When called without command line arguments, the executable is
290 expected to output a list of available map keys separated by
292 Otherwise, the executable will be called with a key name as
293 a command line argument.
294 Output from the executable is expected to be the entry for that key,
295 not including the key itself.
296 .Sh INDIRECT VERSUS DIRECT MAPS
297 Indirect maps are referred to in
299 by entries with a fully qualified path as a mount point, and must contain only
300 relative paths as keys.
301 Direct maps are referred to in
305 as the mountpoint, and must contain only fully qualified paths as keys.
306 For indirect maps, the final mount point is determined by concatenating the
308 mountpoint with the map entry key and optional map entry mountpoint.
309 For direct maps, the final mount point is determined by concatenating
310 the map entry key with the optional map entry mountpoint.
312 The example above could be rewritten using direct map, by placing this in
314 .Bd -literal -offset indent
319 .Li /etc/auto_example
321 .Bd -literal -offset indent
322 .Li /example/x -intr,nfsv4 192.168.1.1:/share/example/x
323 .Li /example/share -fstype=smbfs,-N ://@server/share
324 .Li /example/cd -fstype=cd9660 :/dev/cd0
326 .Sh DIRECTORY SERVICES
329 and maps may contain entries consisting of a plus sign and map name:
330 .Bd -literal -offset indent
336 daemon to retrieve the named map from directory services (like LDAP)
337 and include it where the entry was.
339 If the file containing the map referenced in
341 is not found, the map will be retrieved from directory services instead.
343 To retrieve entries from directory services,
346 .Pa /etc/autofs/include ,
347 which is usually a shell script, with map name as the only command line
349 The script should output entries formatted according to
351 or automounter map syntax to standard output.
352 An example script to use LDAP is included in
353 .Pa /etc/autofs/include_ldap .
354 It can be symlinked to
355 .Pa /etc/autofs/include .
357 .Bl -tag -width ".Pa /etc/auto_master" -compact
358 .It Pa /etc/auto_master
359 The default location of the
363 Directory containing shell scripts to implement special maps and directory
374 configuration file functionality was developed by
375 .An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org
376 under sponsorship from the FreeBSD Foundation.
380 configuration file functionality was ported to
383 .An Tomohiro Kusumi Aq Mt kusumi.tomohiro@gmail.com .
384 Donated to DragonFlyBSD by PeerCorps Trust Fund.
386 .Pa /etc/autofs/special_media
389 currently can't detect HAMMER filesystem consists of more than one volumes.
391 .Pa /etc/autofs/special_media
394 currently ignores md(4) devices by default.