Tasks
- Configure autofs to automatically mount an NFS share located at
nfs-server:/shared
to the local directory /mnt/nfs
.
- Ensure the NFS share is mounted when a user attempts to access the
/mnt/nfs
directory.
- Ensure the NFS share is automatically unmounted after a period of inactivity.
Requirements
- The NFS server IP address is
192.168.1.100
.
- The NFS share must be mounted to the
/mnt/nfs
directory.
- The autofs configuration file must be located at
/etc/auto.master.d/nfs.autofs
.
- The autofs configuration file must include the following content:
/mnt/nfs /etc/auto.nfs
- The
/etc/auto.nfs
file must include the following content:
shared -fstype=nfs,soft,intr 192.168.1.100:/shared
- The autofs service must be restarted after the configuration changes.
Example
After the autofs configuration is complete, when a user attempts to access the /mnt/nfs/shared
directory, the NFS share should be automatically mounted, and the contents of the remote directory should be visible.