The benefit of this is that remote resources can be mounted automatically and without the need for the root user to perform the mount. This is done through the use of a special config file called maps. There are two key files to know when working with AutoFS:
/etc/sysconfig/autofs Main config file for the service
/etc/auto.master Master map file
Let’s take a look a default value in /etc/sysconfig/autofs file.
When you’re working with AutoFS, four different map files are available:
master Contains other types of map files
special Allows for group mounts without defining each one
direct Requires a manual restart
indirect Mount resources under a common parent directory
Let’s take a look at default /etc/auto.master file:
The first entry here is an indirect map. The first part of the entry (/misc) defines the common parent directory under which you’d like to have all your resources mounted. The /etc/auto.misc already exists and contains some samples we can look at as well:
Suppose that you have NFS server and want to map data to your clients. So, on the clients system, you can create the following entry in the /etc/auto.misc file:
Now if you navigate to /misc, you see another directory called data. When this directory is accessed, it mounts the remote NFS share from FileServer automatically to /misc/data. This also allows for easier centralized management for home directories on NFS sersers.
Now, if you want to mount data to different directory instead of /misc, you will need to use direct maps.
Step 1. Create a new entry in the /etc/auto.master file.
Step 2. Create the /etc/auto.direct_maps file and add the following entry:
From now, your data will automatically mount into /tmp directory.
Have fun!