]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - usr.sbin/autofs/auto_master.5
MFC r270096:
[FreeBSD/stable/10.git] / usr.sbin / autofs / auto_master.5
1 .\" Copyright (c) 2014 The FreeBSD Foundation
2 .\" All rights reserved.
3 .\"
4 .\" This software was developed by Edward Tomasz Napierala under sponsorship
5 .\" from the FreeBSD Foundation.
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
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.
15 .\"
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
26 .\" SUCH DAMAGE.
27 .\"
28 .\" $FreeBSD$
29 .\"
30 .Dd July 31, 2014
31 .Dt AUTO_MASTER 5
32 .Os
33 .Sh NAME
34 .Nm auto_master
35 .Nd auto_master and map file format
36 .Sh DESCRIPTION
37 The
38 .Nm
39 configuration file is used by the
40 .Xr automount 8
41 command.
42 Map files are read by the
43 .Xr automountd 8
44 daemon.
45 .Sh AUTO_MASTER SYNTAX
46 The
47 .Nm
48 file consists of lines with two or three entries separated by whitespace
49 and terminated by newline character:
50 .Bd -literal -offset indent
51 .Pa mountpoint Pa map_name Op Ar -options
52 .Ed
53 .Pp
54 .Pa mountpoint
55 is either a fully specified path, or
56 .Li /- .
57 When
58 .Pa mountpoint
59 is a full path,
60 .Pa map_name
61 must reference an indirect map.
62 Otherwise,
63 .Pa map_name
64 must reference a direct map.
65 See
66 .Sx "MAP SYNTAX" below.
67 .Pp
68 .Pa map_name
69 specifies map to use.
70 If
71 .Pa map_name
72 begins with
73 .Li - ,
74 it specifies a special map.
75 See
76 .Sx "MAP SYNTAX"
77 below.
78 If
79 .Pa map_name
80 is not a fully specified path
81 .Pq it does not start with Li / ,
82 .Xr automountd 8
83 will search for that name in
84 .Li /etc .
85 Otherwise it will use the path as given.
86 If the file indicated by
87 .Pa map_name
88 is executable,
89 .Xr automountd 8
90 will assume it is an executable map.
91 See
92 .Sx "MAP SYNTAX"
93 below.
94 Otherwise, the file is opened and the contents parsed.
95 .Pp
96 .Pa -options
97 is an optional field that starts with
98 .Li -
99 and can contain generic filesystem mount options.
100 .Pp
101 The following example specifies that the /etc/auto_example indirect map
102 will be mounted on /example.
103 .Bd -literal -offset indent
104 /example auto_example
105 .Ed
106 .Sh MAP SYNTAX
107 Map files consist of lines with a number of entries separated by whitespace
108 and terminated by newline character:
109 .Bd -literal -offset indent
110 .Pa key Oo Ar -options Oc Oo Ar mountpoint Oo -options Oc Oc Ar location Op ...
111 .Ed
112 .Pp
113 In most cases, it can be simplified to:
114 .Bd -literal -offset indent
115 .Pa key Oo Ar -options Oc Ar location
116 .Ed
117 .Pp
118 .Pa key
119 is the path component used by
120 .Xr automountd 8
121 to find the right map entry to use.
122 It is also used to form the final mountpoint.
123 .Pp
124 The
125 .Ar options
126 field, if present, must begin with
127 .Li - .
128 When mounting the filesystem, options supplied to
129 .Nm
130 and options specified in the map entry are concatenated together.
131 The special option
132 .Li fstype
133 is used to specify filesystem type.
134 It is not passed to the mount program as an option.
135 Instead, it is passed as argument to
136 .Cm "mount -t".
137 .Pp
138 The optional
139 .Pa mountpoint
140 field is used to specify multiple mount points
141 for a single key.
142 .Pp
143 The
144 .Ar location
145 field specifies the filesystem to be mounted.
146 To pass location that begins with
147 .Li / ,
148 prefix it with colon.
149 For example,
150 .Li :/dev/cd0 .
151 .Pp
152 This example, when used with the
153 .Nm
154 example above, specifies that the NFS share
155 .Li 192.168.1.1:/share/example/x
156 will be mounted on
157 .Pa /example/x/
158 when any process attempts to access that mountpoint, with
159 .Li intr
160 and
161 .Li nfsv4
162 mount options:
163 .Bd -literal -offset indent
164 .Li x -intr,nfsv4 192.168.1.1:/share/example/x
165 .Ed
166 .Pp
167 Automatically mount the CD drive on access:
168 .Bd -literal -offset indent
169 .Li cd -intr,fstype=cd9660 :/dev/cd0
170 .Ed
171 .Sh SPECIAL MAPS
172 Special maps have names beginning with
173 .Li - .
174 Supported special maps are:
175 .Pp
176 .Bl -tag -width "-hosts" -compact
177 .It Li -hosts
178 This map queries the remote NFS server and maps exported volumes.
179 It is traditionally mounted on
180 .Pa /net .
181 It enables access to files on a remote NFS server by accessing
182 .Pa /net/nfs-server-ip/share-name/
183 directory, without the need for any further configuration.
184 .It Li -null
185 This map prevents the
186 .Xr automountd 8
187 from mounting anything on the mountpoint.
188 .El
189 .Sh EXECUTABLE MAPS
190 If the map file specified in
191 .Nm
192 has execute bit set, the
193 .Xr automountd 8
194 will execute it and parse the standard output instead of parsing
195 the file contents.
196 .Sh INDIRECT VERSUS DIRECT MAPS
197 Indirect maps are referred to in
198 .Nm
199 by entries with a fully qualified path as a mount point, and must contain only
200 relative paths as keys.
201 Direct maps are referred to in
202 .Nm
203 by entries with
204 .Li /-
205 as the mountpoint, and must contain only fully qualified paths as keys.
206 For indirect maps, the final mount point is determined by concatenating the
207 .Nm
208 mountpoint with the map entry key and optional map entry mountpoint.
209 For direct maps, the final mount point is determined by concatenating
210 the map entry key with the optional map entry mountpoint.
211 .Pp
212 The example above could be rewritten using direct map, by placing this in
213 .Nm :
214 .Bd -literal -offset indent
215 .Li /- auto_example
216 .Ed
217 .Pp
218 and this in
219 .Li /etc/auto_example
220 map file:
221 .Bd -literal -offset indent
222 .Li /example/x -intr,nfsv4 192.168.1.1:/share/example/x
223 .Li /example/cd -intr,fstype=cd9660 :/dev/cd0
224 .Ed
225 .Sh DIRECTORY SERVICES
226 Both
227 .Nm
228 and maps may contain entries consisting of a plus sign and map name:
229 .Bd -literal -offset indent
230 .Li +auto_master
231 .Ed
232 .Pp
233 Those entries cause
234 .Xr automountd 8
235 daemon to retrieve the named map from directory services (like LDAP)
236 and include it where the entry was.
237 .Pp
238 If the file containing the map referenced in
239 .Nm
240 is not found, the map will be retrieved from directory services instead.
241 .Pp
242 To retrieve entries from directory services,
243 .Xr automountd 8
244 daemon runs
245 .Pa /etc/autofs/include ,
246 which is usually a shell script, with map name as the only command line
247 parameter.
248 The script should output entries formatted according to
249 .Nm
250 or automounter map syntax to standard output.
251 An example script to use LDAP is included in
252 .Pa /etc/autofs/include_ldap .
253 It can be symlinked to
254 .Pa /etc/autofs/include .
255 .Sh FILES
256 .Bl -tag -width ".Pa /etc/auto_master" -compact
257 .It Pa /etc/auto_master
258 The default location of the
259 .Pa auto_master
260 file.
261 .El
262 .Sh SEE ALSO
263 .Xr autofs 5 ,
264 .Xr automount 8 ,
265 .Xr automountd 8 ,
266 .Xr autounmountd 8
267 .Sh AUTHORS
268 The
269 .Nm
270 configuration file functionality was developed by
271 .An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org
272 under sponsorship from the FreeBSD Foundation.