AUTOFS(5) | File Formats Manual | AUTOFS(5) |
autofs - Format of the automounter maps
The automounter maps are FILE, NIS, NISPLUS or LDAP (including LDAP via SSS) referred to by the master map of the automounter (see auto.master(5)). These maps describe how file systems below the mount point of the map (given in the master map) are to be mounted. This page describes the sun map format; if another map format, other than amd , is specified (e.g. hesiod), this documentation does not apply.
Indirect maps, except for the internal hosts map, can be changed on the fly and the automouter will recognize those changes on the next operation it performs on that map. Direct maps require a HUP signal be sent to the daemon to refresh their contents as does the master map.
This is a description of the text file format. Other methods of specifying these files may exist. All empty lines or lines beginning with # are ignored. The basic format of one line in such maps is:
key [-options] location
For direct mounts this is the full path of each mount point. This map is always associated with the /- mount point in the master map.
There are several special options
Indirect map:
kernel -ro,soft,intr ftp.kernel.org:/pub/linux boot -fstype=ext2 :/dev/hda1 windoze -fstype=smbfs ://windoze/c removable -fstype=ext2 :/dev/hdd cd -fstype=iso9660,ro :/dev/hdc floppy -fstype=auto :/dev/fd0 server -rw,hard,intr / -ro myserver.me.org:/ \ /usr myserver.me.org:/usr \ /home myserver.me.org:/home
In the first line we have a NFS remote mount of the kernel directory on ftp.kernel.org. This is mounted read-only. The second line mounts an ext2 volume from a local ide drive. The third makes a share exported from a Windows machine available for automounting. The rest should be fairly self-explanatory. The last entry (the last three lines) is an example of a multi-map (see below).
If you use the automounter for a filesystem without access permissions (like vfat), users usually can't write on such a filesystem because it is mounted as user root. You can solve this problem by passing the option gid=<gid>, e.g. gid=floppy. The filesystem is then mounted as group floppy instead of root. Then you can add the users to this group, and they can write to the filesystem. Here's an example entry for an autofs map:
floppy-vfat -fstype=vfat,sync,gid=floppy,umask=002 :/dev/fd0
Direct map:
/nfs/apps/mozilla bogus:/usr/local/moxill /nfs/data/budgets tiger:/usr/local/budgets /tst/sbin bogus:/usr/sbin
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).
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.
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 arbitray code from a user home directory.
Additional entries can be defined with the -Dvariable=Value map-option to automount(8).
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.
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.
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
This version of the automounter supports direct maps stored in FILE, NIS, NISPLUS and LDAP (including LDAP via SSS) only.
This is a description of the text file format. Other methods of specifying mount map entries may be required for different map sources. All empty lines or lines beginning with # are ignored. The basic format of one line in such maps is:
key location-list
A mount location-list can use the cut operator, ||, to specify locations that should be tried if none of the locations to the left of it where selected for a mount attempt.
A mount location consists of an optional colon separated list of selectors, followed by a colon separated list of option:=value pairs.
The selectors that may be used return a value or boolean result. Those that return a value may be to used with the comparison operators == and != and those that return a boolean result may be negated with the !.
For a location to be selected for a mount attempt all of its selectors must evaluate to true. If a location is selected for a mount attempt and succeeds the lookup is completed and returns success. If the mount attempt fails the proceedure continues with the next location until they have all been tried.
In addition some selectors take no argumenets, some one argument and others optionally take two arguments.
The selectors that take no arguments are:
The amd parser key matching is unusual.
The key string to be looked up is constructed by prepending the prefix, if there is one.
The resulting relative path string is matched by first trying the sting itself. If no match is found the last component of the key string is replaced with the wilcard match cahracter ("*") and a wildcard match is attemted. This process continues until a match is found or until the last match, against the wilcard match key alone, fails to match a map entry and the key lookup fails.
Macros are used a lot in the autofs amd implementation.
Many of the option values are set as macro variables corresponding to the option name during the map entry parse. So they may be used in subsequent option values. Beware though, the order in which option values is not necessarily left to right so you may get unexpected results.
Example NFS mount map:
Assuming we have the autofs master map entry:
/test file,amd:/etc/amd.test
And the following map in /etc/amd.test:
/defaults type:=nfs;rhost:=bilbo apps rfs:=/autofs util rhost:=zeus;rfs:=/work/util local rfs:=/shared;sublink:=local
In the first line we have an NFS remote mount of the exported directory /autofs from host bilbo which would be mounted on /test/apps. Next another nfs mount for the exported directory /work/util from host zeus. This would be mounted on /test/util.
Finally we have an example of the use of the sublink option. In this case the filesystem bilbo:/shared would be mounted on a path external the automount directory (under the direcory given by configuration option auto_dir) and the path /test/local either symlinked or bind mounted (depending on the setting autofs_use_lofs) to the "local" subdirectory of the external mount.
To be able to use IPv6 within autofs maps the package must be build to use the libtirpc library for its RPC communications. This is becuase the glibc RPC implementation doesn't support IPv6 and is depricated so this is not likely to change.
automount(8), auto.master(5), autofs(8), autofs.conf(5), mount(8). autofs_ldap_auth.conf(5)
This manual page was written by Christoph Lameter <chris@waterf.org>, for the Debian GNU/Linux system. Edited by H. Peter Avian <hpa@transmeta.com>, Jeremy Fitzhardinge <jeremy@goop.org> and Ian Kent <raven@themaw.net>.
9 Feb 2014 |