Automount as needed NFS shares

In this example, we’re going to setup an automount rule using autofs to mount /home using NFS when a user logs in.

 

as root:

# vi /etc/auto.master

 

Add this at the bottom:

 

/-        auto.home

 

 

# vi /etc/auto.home

 

Add this:

 

/home   -soft,rw,exec,intr      192.168.1.60:/NFS

 

Where:

 

/home = mount point

-soft,rw,exec,intr = whatever

192.168.1.60:/NFS = IP of NFS server and share name