1AUTOFS(5) File Formats Manual AUTOFS(5)
2
3
4
6 autofs - Format of the automounter maps
7
9 The automounter maps are FILE, NIS, NISPLUS or LDAP maps referred to by
10 the master map of the automounter (see auto.master(5)). These maps
11 describe how file systems below the mount point of the map (given in
12 the master map) are to be mounted. This page describes the sun map
13 format; if another map format, other than amd , is specified (e.g. hes‐
14 iod), this documentation does not apply.
15
16 Indirect maps, except for the internal hosts map, can be changed on the
17 fly and the automouter will recognize those changes on the next opera‐
18 tion it performs on that map. Direct maps require a HUP signal be sent
19 to the daemon to refresh their contents as does the master map.
20
22 This is a description of the text file format. Other methods of speci‐
23 fying these files may exist. All empty lines or lines beginning with #
24 are ignored. The basic format of one line in such maps is:
25
26 key [-options] location
27
28 key
29 For indirect mounts this is the part of the path name between
30 the mount point and the path into the filesystem when it is
31 mounted. Usually you can think about the key as a sub-directory
32 name below the autofs managed mount point.
33
34 For direct mounts this is the full path of each mount point.
35 This map is always associated with the /- mount point in the
36 master map.
37
38 options
39 Zero or more options may be given. Options can also be given in
40 the auto.master file in which case both values are cumulative
41 (this is a difference from SunOS). The options are a list of
42 comma separated options as customary for the mount(8) command.
43
44 There are several special options
45
46 -fstype=
47 is used to specify a filesystem type if the filesystem is
48 not of the default NFS type. This option is processed by
49 the automounter and not by the mount command.
50
51 -strict
52 is used to treat errors when mounting file systems as
53 fatal. This is important when multiple file systems
54 should be mounted (`multi-mounts'). If this option is
55 given, no file system is mounted at all if at least one
56 file system can't be mounted.
57
58 -use-weight-only
59 is used to make the weight the sole factor in selecting a
60 server when multiple servers are present in a map entry.
61 and
62
63 -no-use-weight-only
64 can be used to negate the option if it is present in the
65 master map entry for the map but is not wanted for the
66 given mount.
67
68 location
69 The location specifies from where the file system is to be
70 mounted. In the most cases this will be an NFS volume and the
71 usual notation host:pathname is used to indicate the remote
72 filesystem and path to be mounted. If the filesystem to be
73 mounted begins with a / (such as local /dev entries or smbfs
74 shares) a : needs to be prefixed (e.g. :/dev/sda1).
75
77 Indirect map:
78
79 kernel -ro,soft,intr ftp.kernel.org:/pub/linux
80 boot -fstype=ext2 :/dev/hda1
81 windoze -fstype=smbfs ://windoze/c
82 removable -fstype=ext2 :/dev/hdd
83 cd -fstype=iso9660,ro :/dev/hdc
84 floppy -fstype=auto :/dev/fd0
85 server -rw,hard,intr / -ro myserver.me.org:/ \
86 /usr myserver.me.org:/usr \
87 /home myserver.me.org:/home
88
89 In the first line we have a NFS remote mount of the kernel directory on
90 ftp.kernel.org. This is mounted read-only. The second line mounts an
91 ext2 volume from a local ide drive. The third makes a share exported
92 from a Windows machine available for automounting. The rest should be
93 fairly self-explanatory. The last entry (the last three lines) is an
94 example of a multi-map (see below).
95
96 If you use the automounter for a filesystem without access permissions
97 (like vfat), users usually can't write on such a filesystem because it
98 is mounted as user root. You can solve this problem by passing the
99 option gid=<gid>, e.g. gid=floppy. The filesystem is then mounted as
100 group floppy instead of root. Then you can add the users to this group,
101 and they can write to the filesystem. Here's an example entry for an
102 autofs map:
103
104 floppy-vfat -fstype=vfat,sync,gid=floppy,umask=002 :/dev/fd0
105
106 Direct map:
107
108 /nfs/apps/mozilla bogus:/usr/local/moxill
109 /nfs/data/budgets tiger:/usr/local/budgets
110 /tst/sbin bogus:/usr/sbin
111
112
114 Map Key Substitution
115 An & character in the location is expanded to the value of the key
116 field that matched the line (which probably only makes sense together
117 with a wildcard key).
118
119 Wildcard Key
120 A map key of * denotes a wild-card entry. This entry is consulted if
121 the specified key does not exist in the map. A typical wild-card entry
122 looks like this:
123
124 * server:/export/home/&
125
126 The special character '&' will be replaced by the provided key. So, in
127 the example above, a lookup for the key 'foo' would yield a mount of
128 server:/export/home/foo.
129
130 Variable Substitution
131 The following special variables will be substituted in the location
132 field of an automounter map entry if prefixed with $ as customary from
133 shell scripts (curly braces can be used to separate the field name):
134
135 ARCH Architecture (uname -m)
136 CPU Processor Type
137 HOST Hostname (uname -n)
138 OSNAME Operating System (uname -s)
139 OSREL Release of OS (uname -r)
140 OSVERS Version of OS (uname -v)
141
142 autofs provides additional variables that are set based on the user
143 requesting the mount:
144
145 USER The user login name
146 UID The user login ID
147 GROUP The user group name
148 GID The user group ID
149 HOME The user home directory
150 SHOST Short hostname (domain part removed if present)
151
152 If a program map is used these standard environment variables will have
153 a prefix of "AUTOFS_" to prevent interpreted languages like python from
154 being able to load and execute arbitray code from a user home direc‐
155 tory.
156
157 Additional entries can be defined with the -Dvariable=Value map-option
158 to automount(8).
159
160 Executable Maps
161 A map can be marked as executable. A program map will be called with
162 the key as an argument. It may return no lines of output if there's an
163 error, or one or more lines containing a map entry (with \ quoting line
164 breaks). The map entry corresponds to what would normally follow a map
165 key.
166
167 An executable map can return an error code to indicate the failure in
168 addition to no output at all. All output sent to stderr is logged into
169 the system logs.
170
171 Multiple Mounts
172 A multi-mount map can be used to name multiple filesystems to mount.
173 It takes the form:
174
175 key [-options] [mount-point [-options] location...]...
176
177
178 This may extend over multiple lines, quoting the line-breaks with `\´.
179 If present, the per-mountpoint mount-options are appended to the
180 default mount-options.
181
182 Replicated Server
183 Multiple replicated hosts, same path:
184 <path> host1,host2,hostn:/path/path
185
186 Multiple hosts, some with same path, some with another
187 <path> host1,host2:/blah host3:/some/other/path
188
189 Multiple replicated hosts, different (potentially) paths:
190 <path> host1:/path/pathA host2:/path/pathB
191
192 Mutliple weighted, replicated hosts same path:
193 <path> host1(5),host2(6),host3(1):/path/path
194
195 Multiple weighted, replicated hosts different (potentially) paths:
196 <path> host1(3):/path/pathA host2(5):/path/pathB
197
198 Anything else is questionable and unsupported, but these variations will also work:
199 <path> host1(3),host:/blah
200
202 This version of the automounter supports direct maps stored in FILE,
203 NIS, NISPLUS and LDAP only.
204
206 This is a description of the text file format. Other methods of speci‐
207 fying mount map entries may be required for different map sources. All
208 empty lines or lines beginning with # are ignored. The basic format of
209 one line in such maps is:
210
211 key location-list
212
213 key
214 A key is a path (or a single path component alone) that may end
215 in the wildcard key, "*", or the wildcard key alone and must not
216 begin with the "/" character.
217
218 location-list
219 Following the key is a mount location-list.
220
221 A location-list list has the following syntax:
222
223 location[ location[ ... ]] [|| location[ location[ ... ]]
224
225 A mount location-list can use the cut operator, ||, to specify loca‐
226 tions that should be tried if none of the locations to the left of it
227 where selected for a mount attempt.
228
229 A mount location consists of an optional colon seperated list of selec‐
230 tors, followed by a colon seperated list of option:=value pairs.
231
232 The selectors that may be used return a value or boolean result. Those
233 that return a value may be to used with the comparison operators == and
234 != and those that return a boolean result may be negated with the !.
235
236 For a location to be selected for a mount attempt all of its selectors
237 must evaluate to true. If a location is selected for a mount attempt
238 and succeeds the lookup is completed and returns success. If the mount
239 attempt fails the proceedure continues with the next location until
240 they have all been tried.
241
242 In addition some selectors take no argumenets, some one argument and
243 others optionally take two arguments.
244
245 The selectors that take no arguments are:
246
247 arch
248 The machine architecture which, if not set in the confu‐
249 gration, is obtained using uname(2).
250
251 karch
252 The machine kernel architecture which, if not set in the
253 confugration, is obtained using uname(2).
254
255 os
256 The operating system name, if not set in the confugra‐
257 tion, is obtained using uname(2).
258
259 osver
260 The operating system version, if not set in the confugra‐
261 tion, is obtained using uname(2).
262
263 full_os
264 The full operating system name, if not set in the confu‐
265 gration this selector has no value.
266
267 vendor
268 The operating system vendor name, if not set in the
269 confugration this selector has the value "unknown".
270
271 byte
272 The endianess of the hardware.
273
274 cluster
275 The name of the local cluster. It has a value only if it
276 is set in the configuration.
277
278 autodir
279 The base path under which external mounts are done if
280 they are needed. Most mounts are done in place but some
281 can't be and this is the base path under which those
282 mounts will be done.
283
284 domain
285 The local domain name. It is set to the value of the con‐
286 figuration option sub_domain. If sub_domain is not given
287 in the configuration it is set to the domain part of the
288 local host name, as given by gethostname(2).
289
290 host
291 The local host name, without the domain part, as given by
292 gethostname(2).
293
294 hostd
295 The full host name. If sub_domain is given in the config‐
296 uration this is set to the contatenation of host and
297 sub_domain deperated by a .. If sub_domain is not set in
298 the configuration the value of domain is used instead of
299 sub_domain.
300
301 uid
302 The numeric value of the uid of the user that first
303 requested the mount. Note this is usual the same as that
304 used by amd but can be different within autofs.
305
306 gid
307 The numeric value of the gid of the user that first
308 requested the mount. Note this is usual the same as that
309 used by amd but can be different within autofs.
310
311 key
312 The string value of the key being looked up.
313
314 map
315 The string value of the map name used to lookup keys.
316
317 path
318 The string value of the full path to the mount being
319 requested.
320
321 dollar
322 Evaluates to the string "$".
323
324 The selectors that take one argument are:
325
326 in_network(network) , network(network) , netnumber(network) ,
327 wire(network)
328 These selectors are all the same. in_network() is the
329 preferred usage. The network argument is an address
330 (which may include a subnet mask) or network name. The
331 function compares network against each interface and
332 returns true if network belongs to the network the inter‐
333 face is connected to.
334
335 xhost(hostname)
336 The xhost() selector compares hostname to the ${host} and
337 if it doesn't match it attempts to lookup the cannonical
338 name of hostname and compares it to {host} as well.
339
340 exists(filename)
341 Returns true if filename exits as determined by lstat(2).
342
343 true()
344 Evaluates to true, the argument is ignored and may be
345 empty.
346
347 false()
348 Evaluates to false, the argument is ignored and may be
349 empty.
350
351 The selectors that take up to two arguments are:
352
353 netgrp(netgroup[,hostname])
354 The netgrp() selector returns true if hostname is a mem‐
355 ber of the netgroup netgroup. If hostname is not given
356 ${host} is used for the comparison.
357
358 netgrpd(netgroup[,hostname])
359 The netgrpd()i selector behaves the same as netgrp()
360 except that if hostname is not given ${hostd}, the fully
361 qualified hostname, is used instead of ${host}.
362
363 The options that may be used are:
364
365 type
366 This is the mount filesystem type. It can have a value
367 of auto, link, linkx, host, lofs, ext2-4, xfs, nfs, nfsl
368 or cdfs. Other types that are not yet implemented or are
369 not available iin autofs are nfsx, lustre, jfs, program,
370 cachefs and direct.
371
372 maptype
373 The maptype option specifies the type of the map source
374 and can have a value of file, nis, nisplus, exec, ldap or
375 hesiod. Map sources either not yet implemented or not
376 available in autofs are sss, ndbm, passwd and union.
377
378 fs
379 The option fs is used to specify the local filesystem.
380 The meaning of this option (and whether or not it is
381 used) is dependent on the mount filesystem type.
382
383 rhost
384 The remote host name for network mount requests.
385
386 rfs
387 The remote host filesystem path for network mount
388 requests.
389
390 dev
391 Must resolve to the device file for local device mount
392 requests.
393
394 sublink
395 The sublink option is used to specify a subdirectory
396 within the mount location to which this entry will point.
397
398 pref
399 The pref option is used to specify a prefix that is
400 prepended to the lookup key before looking up the map
401 entry key.
402
403 opts
404 The opts option is used to specify mount options to be
405 used for the mount. If a "-" is given it is ignored.
406 Options that may be used are dependend on the mount
407 filesystem.
408
409 addopts
410 The addopts option is used to specify additional mount
411 options used in addition to the default mount options for
412 the mount location.
413
414 remopts
415 The addopts option is used to specify mount options used
416 instead the options given in opts when the mount location
417 is on a remote retwork.
418
419 A number of options aren't available or aren't yet implemented
420 within autofs, these are:
421
422 cache
423 The cache option isn't used by autofs. The map entry
424 cache is continually updated and stale entries cleaned on
425 re-load when map changes are detected so these configura‐
426 tion entries are not used. The regex map key matching is
427 not implemented and may not be due to the potential over‐
428 head of the full map scans needed on every key lookup.
429
430 cachedir
431 The cachefs filesystem is not available on Linux, a dif‐
432 ferent implementation is used for caching network mounted
433 file systems.
434
435 mount , unmount , umount
436 These options are used by the amd program mount type
437 which is not yet implemented.
438
439 delay
440 This option is not used by the autofs implementation and
441 is ignored.
442
443
445 Key Matching
446 The amd parser key matching is unusual.
447
448 The key string to be looked up is constructed by prepending the prefix,
449 if there is one.
450
451 The resulting relative path string is matched by first trying the sting
452 itself. If no match is found the last component of the key string is
453 replaced with the wilcard match cahracter ("*") and a wildcard match is
454 attemted. This process continues until a match is found or until the
455 last match, against the wilcard match key alone, fails to match a map
456 entry and the key lookup fails.
457
458 Macro Usage
459 Macros are used a lot in the autofs amd implementation.
460
461 Many of the option values are set as macro variables corresponding to
462 the option name during the map entry parse. So they may be used in sub‐
463 sequent option values. Beware though, the order in which option values
464 is not necessarily left to right so you may get unexpected results.
465
467 Example NFS mount map:
468
469 Assuming we have the autofs master map entry:
470
471 /test file,amd:/etc/amd.test
472
473 And the following map in /etc/amd.test:
474
475 /defaults type:=nfs;rhost:=bilbo
476 apps rfs:=/autofs
477 util rhost:=zeus;rfs:=/work/util
478 local rfs:=/shared;sublink:=local
479
480 In the first line we have an NFS remote mount of the exported directory
481 /autofs from host bilbo which would be mounted on /test/apps. Next
482 another nfs mount for the exported directory /work/util from host zeus.
483 This would be mounted on /test/util.
484
485 Finally we have an example of the use of the sublink option. In this
486 case the filesystem bilbo:/shared would be mounted on a path external
487 the automount directory (under the direcory given by configuration
488 option auto_dir) and the path /test/local either symlinked or bind
489 mounted (depending on the setting autofs_use_lofs) to the "local" sub‐
490 directory of the external mount.
491
493 automount(8), auto.master(5), autofs(8), autofs.conf(5), mount(8).
494 autofs_ldap_auth.conf(5)
495
497 This manual page was written by Christoph Lameter <chris@waterf.org>,
498 for the Debian GNU/Linux system. Edited by H. Peter Avian <hpa@trans‐
499 meta.com>, Jeremy Fitzhardinge <jeremy@goop.org> and Ian Kent
500 <raven@themaw.net>.
501
502
503
504 9 Feb 2014 AUTOFS(5)