autofs.conf - Linux
Overview
autofs.conf is a configuration file that defines the behavior of the autofs
mount manager. It allows administrators to automate the mounting and unmounting of file systems based on user access patterns.
Syntax
# Global options
[global]
use_canonical_names = boolean
GCacheTimeout = seconds
MountpointTimeout = seconds
timeout = seconds
inactivity = seconds
asterisk_as_root = boolean
automount_max_retries = integer
automount_min_retries = integer
automount_delay_time = seconds
# Mount maps
[map]
type = string
bfs_path = string
subdirs = boolean
mount_point = string
mount_type = string
mount_opts = string
auto_dir = boolean
Options/Flags
Global Options
| Option | Description | Default Value |
|—|—|—|
| use_canonical_names
| Use canonical names for mount points | false |
| GCacheTimeout
| Global cache timeout for NFS mounts | 600 seconds |
| MountpointTimeout
| Timeout for mount points | 120 seconds |
| timeout
| Mount timeout | 60 seconds |
| inactivity
| Inactivity timeout for mounted file systems | 3600 seconds |
| asterisk_as_root
| Mount maps with ‘*’ prefix as root | false |
| automount_max_retries
| Maximum number of retries for automounting | 4 |
| automount_min_retries
| Minimum number of retries for automounting | 1 |
| automount_delay_time
| Delay time between automount retries | 0 seconds |
Mount Maps
| Option | Description | Default Value |
|—|—|—|
| type
| Mount type (e.g., nfs, cifs, samba) | Required |
| bfs_path
| Path for browsing file systems | Required |
| subdirs
| Mount subdirectories instead of file systems | false |
| mount_point
| Mount point for the file system | Required |
| mount_type
| Specific type of mount (e.g., vboxsf, fuse) | Required |
| mount_opts
| Mount options for the file system | "" |
| auto_dir
| Create an automount directory in the mount point | true |
Examples
Remote NFS Mount
[map google-drive]
type = nfs
bfs_path = /mnt/google-drive
mount_point = /mnt/mygoogle
mount_type = nfs4
mount_opts = ro
Samba Share Mount
[map windows-share]
type = cifs
bfs_path = //myshare.example.com/public
mount_point = /mnt/share
mount_type = cifs
mount_opts = rw,user=myuser,password=mypassword
Local File System Mount
[map local-data]
type = local
bfs_path = /home/user/data
mount_point = /mnt/data
mount_type = ext4
Common Issues
- No automounting: Check the syntax of the configuration file. Ensure that the mount maps are defined correctly and that the
autofs
service is running. - Long mount times: Increase the
MountpointTimeout
ortimeout
values in the global options. - Permission denied: Verify that the specified mount options provide the necessary permissions for mounting.
Integration
Autofs can be integrated with other commands such as ls
and cd
for enhanced navigation. It can also be used in conjunction with scripting languages like Bash and Python for automation tasks.
Related Commands
automount
– Automatic mount point managerautofs
– Daemon that manages the mounting and unmounting of file systems