AutoFS Configuration for Home Directories
Overview of AutoFS Setup for Home Directories
AutoFS is a tool used for managing automounting of directories, particularly useful for user home directories.
It allows users to seamlessly access their home directories from multiple systems where AutoFS is operational.
NFS Server Role
In this setup, a Network File System (NFS) server provides home directory access.
Home directories are auto-mounted when a user logs in.
The convenience aspect: Users can log in to any system running AutoFS and have consistent access to their NFS-provided home directories.
Using Wildcards in Auto Mount Configuration
To support various directory names in a single automount line, wildcards are necessary.
Example of the wildcard configuration:
* -rw,nfs_server:/home/l_dapp/&This line indicates:
Any access to
home/l_dapp/*triggers mounting fromnfs_server:/home/l_dapp/&.The
&symbol is used to match the wildcard*.
Configuration Steps
Step 1: Edit /etc/auto.master
The primary configuration file for AutoFS is located at
/etc/auto.master.The entry added here determines the mount point and points to additional configuration:
Example entry:
/home/l_dapppoints to/etc/auto.l_dapp.
Step 2: Create /etc/auto.l_dapp
Create a new file for the specific AutoFS configuration:
Location:
/etc/auto.l_dappAdd the following line to define the automount behavior:
* -rw,nfs_server:/home/l_dapp/&
Restarting AutoFS
It is essential to restart AutoFS after making changes to the configuration files.
This ensures the new settings take effect.
Verification of Auto-mounted Directories
After configuration and restart, verify the home directory accessibility:
Navigate to
/home/l_dapp. Initially, it appears empty.However, attempting to access a user directory like
l_dab/user_whateverdemonstrates that it is automatically mounted.Example command execution:
ls /home/l_dab/user_whateverResult: AutoFS will mount the directory dynamically.
Additional User Directories
More user directories (e.g.,
l_dab/user_something_else) will automatically mount as needed.The
mountcommand can be used to show active mounts, confirming their presence.
Automatic Unmounting
AutoFS will automatically unmount directories after a specified period of inactivity.
This feature helps in managing system resources efficiently, preventing unnecessary mounts.