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