Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   autofs    ( 5 )

формат карт автомонтирования (Format of the automounter maps)

  Name  |  Description  |  Sun format  |  Examples  |    Features    |  Unsupported  |  Amd format  |  Note  |  See also  |

Особенности (Features)

Map Key Substitution
       An & character in the location is expanded to the value of the
       key field that matched the line (which probably only makes sense
       together with a wildcard key).

Wildcard Key A map key of * denotes a wild-card entry. This entry is consulted if the specified key does not exist in the map. A typical wild- card entry looks like this:

* server:/export/home/&

The special character '&' will be replaced by the provided key. So, in the example above, a lookup for the key 'foo' would yield a mount of server:/export/home/foo.

Variable Substitution The following special variables will be substituted in the location field of an automounter map entry if prefixed with $ as customary from shell scripts (curly braces can be used to separate the field name):

ARCH Architecture (uname -m) CPU Processor Type HOST Hostname (uname -n) OSNAME Operating System (uname -s) OSREL Release of OS (uname -r) OSVERS Version of OS (uname -v)

autofs provides additional variables that are set based on the user requesting the mount:

USER The user login name UID The user login ID GROUP The user group name GID The user group ID HOME The user home directory SHOST Short hostname (domain part removed if present)

If a program map is used these standard environment variables will have a prefix of "AUTOFS_" to prevent interpreted languages like python from being able to load and execute arbitrary code from a user home directory.

Additional entries can be defined with the -Dvariable=Value map- option to automount(8).

Executable Maps A map can be marked as executable. A program map will be called with the key as an argument. It may return no lines of output if there's an error, or one or more lines containing a map entry (with \ quoting line breaks). The map entry corresponds to what would normally follow a map key.

An executable map can return an error code to indicate the failure in addition to no output at all. All output sent to stderr is logged into the system logs.

Multiple Mounts A multi-mount map can be used to name multiple filesystems to mount. It takes the form:

key [ -options ] [[/] location [/relative-mount-point [ -options ] location...]...

This may extend over multiple lines, quoting the line-breaks with `\´. If present, the per-mountpoint mount-options are appended to the default mount-options. This behaviour may be overridden by the append_options configuration setting.

Replicated Server A mount location can specify multiple hosts for a location, portentially with a different export path for the same file system. Historically these different locations are read-only and provide the same replicated file system.

Multiple replicated hosts, same path: <path> host1,host2,hostn:/path/path

Multiple hosts, some with same path, some with another <path> host1,host2:/blah host3:/some/other/path

Multiple replicated hosts, different (potentially) paths: <path> host1:/path/pathA host2:/path/pathB

Mutliple weighted, replicated hosts same path: <path> host1(5),host2(6),host3(1):/path/path

Multiple weighted, replicated hosts different (potentially) paths: <path> host1(3):/path/pathA host2(5):/path/pathB

Anything else is questionable and unsupported, but these variations will also work: <path> host1(3),host:/blah