NFS share using autofs in Ubuntu Linux.

Autofs is a service in Linux like operating system which automatically mounts the file system and remote shares when it is accessed. Main advantage of autofs is that you don’t need to mount file system at all time, file system is only mounted when it is in demand.

Autofs service reads two files Master map file ( /etc/auto.master ) and a map file like/etc/auto.misc or /etc/auto.xxxx.
In ‘/etc/auto.master’ file we have three different fields :
/<Mount-Point>     <Map-file>     <Timeout-Value>
In map file (/etc/auto.misc or /etc/auto.xxxx) also we have three different fields:
<Mount-Point>    <Mount-Options>        <Location_of_File System>
In this article we will mount the NFS share using autofs. NFS share ‘/db_backup‘ is exported from Fedora NFS Server ( We are going to mount this nfs share on Ubuntu  Linux using autofs.

Step:1 Install the autofs package using apt-get command.

root@hackthesec:~$ sudo apt-get install autofs

Step:2 Edit the Master Map file ‘/etc/auto.master’

Add the following line in the master map file.
root@hackthesec:~$ sudo vi /etc/auto.master
/dbstuff   /etc/auto.nfsdb   --timeout=180
Save & exit the file.
Create the mount point.
root@hackthesec:~$ sudo mkdir /dbstuff

Step:2 Create a map file ‘/etc/auto.nfsdb’.

Add the following line in the map file.
root@hackthesec:~$ sudo vi /etc/auto.nfsdb
db_backup   -fstype=nfs4,rw,soft,intr

Step:3 Start the autofs service.

root@hackthesec:~$ sudo /etc/init.d/autofs start

Step:4 Try to access the mount point.

About Author:

I am a Linux Administrator and Security Expert with this site i can help lot's of people about linux knowladge and as per security expert i also intersted about hacking related news.TwitterFacebook

Newer Post
Older Post


Post a Comment