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
31 .Dd September 26, 2019
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
195 Expands to the output of
198 Expands to the output of
201 Expands to the output of
204 Expands to the output of
208 Additional variables can be defined with the
215 To pass a location that begins with
217 prefix it with a colon.
221 This example, when put into
222 .Pa /etc/auto_example ,
225 referring to the map as described above, specifies that the NFS share
226 .Li 192.168.1.1:/share/example/x
229 when any process attempts to access that mountpoint, with
233 mount options, described in
235 .Bd -literal -offset indent
236 .Li x -intr,nfsv4 192.168.1.1:/share/example/x
239 Automatically mount an SMB share on access, as a guest user,
240 without prompting for a password:
241 .Bd -literal -offset indent
242 .Li share -fstype=smbfs,-N ://@server/share
245 Automatically mount the CD drive on access:
246 .Bd -literal -offset indent
247 .Li cd -fstype=cd9660 :/dev/cd0
250 Special maps have names beginning with
252 Supported special maps are:
254 .Bl -tag -width "-hosts" -compact
256 Query the remote NFS server and map exported shares.
257 This map is traditionally mounted on
259 Access to files on a remote NFS server is provided through the
260 .Pf /net/ Ar nfs-server-ip Ns / Ns Ar share-name Ns/
261 directory without any additional configuration.
262 Directories for individual NFS servers are not present until the first access,
263 when they are automatically created.
265 Query devices that are not yet mounted, but contain valid filesystems.
266 Generally used to access files on removable media.
268 Mount filesystems configured in
271 This needs to be set up as a direct map.
275 from mounting anything on the mountpoint.
278 It is possible to add custom special maps by adding them, as executable
285 If the map file specified in
287 has the execute bit set,
289 will execute it and parse the standard output instead of parsing
291 When called without command line arguments, the executable is
292 expected to output a list of available map keys separated by
294 Otherwise, the executable will be called with a key name as
295 a command line argument.
296 Output from the executable is expected to be the entry for that key,
297 not including the key itself.
298 .Sh INDIRECT VERSUS DIRECT MAPS
299 Indirect maps are referred to in
301 by entries with a fully qualified path as a mount point, and must contain only
302 relative paths as keys.
303 Direct maps are referred to in
307 as the mountpoint, and must contain only fully qualified paths as keys.
308 For indirect maps, the final mount point is determined by concatenating the
310 mountpoint with the map entry key and optional map entry mountpoint.
311 For direct maps, the final mount point is determined by concatenating
312 the map entry key with the optional map entry mountpoint.
314 The example above could be rewritten using direct map, by placing this in
316 .Bd -literal -offset indent
321 .Li /etc/auto_example
323 .Bd -literal -offset indent
324 .Li /example/x -intr,nfsv4 192.168.1.1:/share/example/x
325 .Li /example/share -fstype=smbfs,-N ://@server/share
326 .Li /example/cd -fstype=cd9660 :/dev/cd0
328 .Sh DIRECTORY SERVICES
331 and maps may contain entries consisting of a plus sign and map name:
332 .Bd -literal -offset indent
338 daemon to retrieve the named map from directory services (like LDAP)
339 and include it where the entry was.
341 If the file containing the map referenced in
343 is not found, the map will be retrieved from directory services instead.
345 To retrieve entries from directory services,
348 .Pa /etc/autofs/include ,
349 which is usually a shell script, with map name as the only command line
351 The script should output entries formatted according to
353 or automounter map syntax to standard output.
354 An example script to use LDAP is included in
355 .Pa /etc/autofs/include_ldap .
356 It can be symlinked to
357 .Pa /etc/autofs/include .
359 .Bl -tag -width ".Pa /etc/auto_master" -compact
360 .It Pa /etc/auto_master
361 The default location of the
365 Directory containing shell scripts to implement special maps and directory
376 configuration file functionality was developed by
377 .An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org
378 under sponsorship from the FreeBSD Foundation.
382 configuration file functionality was ported to
385 .An Tomohiro Kusumi Aq Mt tkusumi@netbsd.org .
386 Donated to DragonFlyBSD by PeerCorps Trust Fund.
388 .Pa /etc/autofs/special_media
391 currently can't detect HAMMER filesystem consists of more than one volumes.
393 .Pa /etc/autofs/special_media
396 currently ignores md(4) devices by default.