1AUTOFS(5)                     File Formats Manual                    AUTOFS(5)
2
3
4

NAME

6       autofs - Format of the automounter maps
7

DESCRIPTION

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

SUN FORMAT

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

EXAMPLE

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

FEATURES

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 ] [[/] location [/relative-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.  This  behaviour  may  be  overridden  by  the
181       append_options configuration setting.
182
183   Replicated Server
184       A mount location can specify multiple hosts  for  a  location,  porten‐
185       tially  with a different export path for the same file system. Histori‐
186       cally these different locations are  read-only  and  provide  the  same
187       replicated file system.
188
189         Multiple replicated hosts, same path:
190         <path> host1,host2,hostn:/path/path
191
192         Multiple hosts, some with same path, some with another
193         <path> host1,host2:/blah host3:/some/other/path
194
195         Multiple replicated hosts, different (potentially) paths:
196         <path> host1:/path/pathA host2:/path/pathB
197
198         Mutliple weighted, replicated hosts same path:
199         <path> host1(5),host2(6),host3(1):/path/path
200
201         Multiple weighted, replicated hosts different (potentially) paths:
202         <path> host1(3):/path/pathA host2(5):/path/pathB
203
204         Anything else is questionable and unsupported, but these variations will also work:
205         <path> host1(3),host:/blah
206

UNSUPPORTED

208       This  version  of  the automounter supports direct maps stored in FILE,
209       NIS, NISPLUS and LDAP only.
210

AMD FORMAT

212       This is a description of the text file format. Other methods of  speci‐
213       fying mount map entries may be required for different map sources.  All
214       empty lines or lines beginning with # are ignored. The basic format  of
215       one line in such maps is:
216
217       key location-list
218
219       key
220              A  key is a path (or a single path component alone) that may end
221              in the wildcard key, "*", or the wildcard key alone and must not
222              begin with the "/" character.
223
224       location-list
225              Following the key is a mount location-list.
226
227       A location-list list has the following syntax:
228
229       location[ location[ ... ]] [|| location[ location[ ... ]]
230
231       A  mount  location-list  can use the cut operator, ||, to specify loca‐
232       tions that should be tried if none of the locations to the left  of  it
233       where selected for a mount attempt.
234
235       A mount location consists of an optional colon seperated list of selec‐
236       tors, followed by a colon seperated list of option:=value pairs.
237
238       The selectors that may be used return a value or boolean result.  Those
239       that return a value may be to used with the comparison operators == and
240       != and those that return a boolean result may be negated with the !.
241
242       For a location to be selected for a mount attempt all of its  selectors
243       must  evaluate  to  true. If a location is selected for a mount attempt
244       and succeeds the lookup is completed and returns success. If the  mount
245       attempt  fails  the  proceedure  continues with the next location until
246       they have all been tried.
247
248       In addition some selectors take no argumenets, some  one  argument  and
249       others optionally take two arguments.
250
251       The selectors that take no arguments are:
252
253              arch
254                     The  machine architecture which, if not set in the confu‐
255                     gration, is obtained using uname(2).
256
257              karch
258                     The machine kernel architecture which, if not set in  the
259                     confugration, is obtained using uname(2).
260
261              os
262                     The  operating  system  name, if not set in the confugra‐
263                     tion, is obtained using uname(2).
264
265              osver
266                     The operating system version, if not set in the confugra‐
267                     tion, is obtained using uname(2).
268
269              full_os
270                     The  full operating system name, if not set in the confu‐
271                     gration this selector has no value.
272
273              vendor
274                     The operating system vendor  name,  if  not  set  in  the
275                     confugration this selector has the value "unknown".
276
277              byte
278                     The endianess of the hardware.
279
280              cluster
281                     The  name of the local cluster. It has a value only if it
282                     is set in the configuration.
283
284              autodir
285                     The base path under which external  mounts  are  done  if
286                     they  are needed.  Most mounts are done in place but some
287                     can't be and this is the  base  path  under  which  those
288                     mounts will be done.
289
290              domain
291                     The local domain name. It is set to the value of the con‐
292                     figuration option sub_domain. If sub_domain is not  given
293                     in  the configuration it is set to the domain part of the
294                     local host name, as given by gethostname(2).
295
296              host
297                     The local host name, without the domain part, as given by
298                     gethostname(2).
299
300              hostd
301                     The full host name. If sub_domain is given in the config‐
302                     uration this is set to  the  contatenation  of  host  and
303                     sub_domain  deperated by a .. If sub_domain is not set in
304                     the configuration the value of domain is used instead  of
305                     sub_domain.
306
307              uid
308                     The  numeric  value  of  the  uid  of the user that first
309                     requested the mount. Note this is usual the same as  that
310                     used by amd but can be different within autofs.
311
312              gid
313                     The  numeric  value  of  the  gid  of the user that first
314                     requested the mount. Note this is usual the same as  that
315                     used by amd but can be different within autofs.
316
317              key
318                     The string value of the key being looked up.
319
320              map
321                     The string value of the map name used to lookup keys.
322
323              path
324                     The  string  value  of  the  full path to the mount being
325                     requested.
326
327              dollar
328                     Evaluates to the string "$".
329
330       The selectors that take one argument are:
331
332              in_network(network) ,  network(network) ,  netnumber(network)  ,
333              wire(network)
334                     These  selectors  are  all  the same. in_network() is the
335                     preferred usage.  The  network  argument  is  an  address
336                     (which  may  include  a subnet mask) or network name. The
337                     function compares  network  against  each  interface  and
338                     returns true if network belongs to the network the inter‐
339                     face is connected to.
340
341              xhost(hostname)
342                     The xhost() selector compares hostname to the ${host} and
343                     if  it doesn't match it attempts to lookup the cannonical
344                     name of hostname and compares it to {host} as well.
345
346              exists(filename)
347                     Returns true if filename exits as determined by lstat(2).
348
349              true()
350                     Evaluates to true, the argument is  ignored  and  may  be
351                     empty.
352
353              false()
354                     Evaluates  to  false,  the argument is ignored and may be
355                     empty.
356
357       The selectors that take up to two arguments are:
358
359              netgrp(netgroup[,hostname])
360                     The netgrp() selector returns true if hostname is a  mem‐
361                     ber  of  the  netgroup netgroup. If hostname is not given
362                     ${host} is used for the comparison.
363
364              netgrpd(netgroup[,hostname])
365                     The netgrpd()i selector  behaves  the  same  as  netgrp()
366                     except  that if hostname is not given ${hostd}, the fully
367                     qualified hostname, is used instead of ${host}.
368
369       The options that may be used are:
370
371              type
372                     This is the mount filesystem type.  It can have  a  value
373                     of  auto, link, linkx, host, lofs, ext2-4, xfs, nfs, nfsl
374                     or cdfs.  Other types that are not yet implemented or are
375                     not  available  in autofs are nfsx, lustre, jfs, program,
376                     cachefs and direct.
377
378              maptype
379                     The maptype option specifies the type of the  map  source
380                     and can have a value of file, nis, nisplus, exec, ldap or
381                     hesiod. Map sources either not  yet  implemented  or  not
382                     available in autofs are sss, ndbm, passwd and union.
383
384              fs
385                     The  option  fs  is used to specify the local filesystem.
386                     The meaning of this option (and  whether  or  not  it  is
387                     used) is dependent on the mount filesystem type.
388
389              rhost
390                     The remote host name for network mount requests.
391
392              rfs
393                     The   remote  host  filesystem  path  for  network  mount
394                     requests.
395
396              dev
397                     Must resolve to the device file for  local  device  mount
398                     requests.
399
400              sublink
401                     The  sublink  option  is  used  to specify a subdirectory
402                     within the mount location to which this entry will point.
403
404              pref
405                     The pref option is used  to  specify  a  prefix  that  is
406                     prepended  to  the  lookup  key before looking up the map
407                     entry key.
408
409              opts
410                     The opts option is used to specify mount  options  to  be
411                     used  for  the  mount.  If  a "-" is given it is ignored.
412                     Options that may be  used  are  dependend  on  the  mount
413                     filesystem.
414
415              addopts
416                     The  addopts  option  is used to specify additional mount
417                     options used in addition to the default mount options for
418                     the mount location.
419
420              remopts
421                     The  addopts option is used to specify mount options used
422                     instead the options given in opts when the mount location
423                     is on a remote retwork.
424
425       A number of options aren't available or aren't yet implemented
426              within autofs, these are:
427
428              cache
429                     The  cache  option  isn't  used  by autofs. The map entry
430                     cache is continually updated and stale entries cleaned on
431                     re-load when map changes are detected so these configura‐
432                     tion entries are not used.  The regex map key matching is
433                     not implemented and may not be due to the potential over‐
434                     head of the full map scans needed on every key lookup.
435
436              cachedir
437                     The cachefs filesystem is not available on Linux, a  dif‐
438                     ferent implementation is used for caching network mounted
439                     file systems.
440
441              mount ,  unmount ,  umount
442                     These options are used by  the  amd  program  mount  type
443                     which is not yet implemented.
444
445              delay
446                     This  option is not used by the autofs implementation and
447                     is ignored.
448
449

FEATURES

451   Key Matching
452       The amd parser key matching is unusual.
453
454       The key string to be looked up is constructed by prepending the prefix,
455       if there is one.
456
457       The resulting relative path string is matched by first trying the sting
458       itself. If no match is found the last component of the  key  string  is
459       replaced with the wilcard match cahracter ("*") and a wildcard match is
460       attemted. This process continues until a match is found  or  until  the
461       last  match,  against the wilcard match key alone, fails to match a map
462       entry and the key lookup fails.
463
464   Macro Usage
465       Macros are used a lot in the autofs amd implementation.
466
467       Many of the option values are set as macro variables  corresponding  to
468       the option name during the map entry parse. So they may be used in sub‐
469       sequent option values. Beware though, the order in which option  values
470       is not necessarily left to right so you may get unexpected results.
471

EXAMPLE

473       Example NFS mount map:
474
475       Assuming we have the autofs master map entry:
476
477         /test     file,amd:/etc/amd.test
478
479       And the following map in /etc/amd.test:
480
481         /defaults type:=nfs;rhost:=bilbo
482         apps      rfs:=/autofs
483         util      rhost:=zeus;rfs:=/work/util
484         local     rfs:=/shared;sublink:=local
485
486       In the first line we have an NFS remote mount of the exported directory
487       /autofs from host bilbo which would  be  mounted  on  /test/apps.  Next
488       another nfs mount for the exported directory /work/util from host zeus.
489       This would be mounted on /test/util.
490
491       Finally we have an example of the use of the sublink  option.  In  this
492       case  the  filesystem bilbo:/shared would be mounted on a path external
493       the automount directory (under  the  direcory  given  by  configuration
494       option  auto_dir)  and  the  path  /test/local either symlinked or bind
495       mounted (depending on the setting autofs_use_lofs) to the "local"  sub‐
496       directory of the external mount.
497

SEE ALSO

499       automount(8), auto.master(5), autofs(8), autofs.conf(5), mount(8), aut‐
500       ofs_ldap_auth.conf(5).
501

AUTHOR

503       This manual page was written by Christoph  Lameter  <chris@waterf.org>,
504       for  the Debian GNU/Linux system.  Edited by H. Peter Avian <hpa@trans‐
505       meta.com>,  Jeremy  Fitzhardinge   <jeremy@goop.org>   and   Ian   Kent
506       <raven@themaw.net>.
507
508
509
510                                  9 Feb 2014                         AUTOFS(5)
Impressum