Almost Zero Configuration NFS Network Shares using AutoFS

AutoFS is a great and easy way to mount file-systems automatically, on-demand, when available. It works great for both networked and non-networked drives.

I have a HP Laptop which I use as my development machine and a (highly-)upgraded Compaq CQ 3329-IX that doubles as my development as well as file-server. I want my files to be available automatically, whenever I am connected to my home-network. I cannot add a fstab entry as I am not always connected to the same network.

AutoFS to the rescue

This assumes you already have a working NFS share setup, in a machine with host name — theserver, and let’s say your client is named as - theclient.

AutoFS needs domain names, thus you need a DNS stack such as Avahi/mDNS, a DHCP server or appropriate entries in /etc/hosts

My home network uses mDNS. My host and my client are assigned thehost.local and theclient.local respectively. mDNS sets up domain names with zero configuration, and works in a variety of devices, including mobile.

Installing and configuring AutoFS

Now you will be automatically be able to access files at theserver.local at /net/theserver.local/share, where share is the path configured at /etc/exports in theserver.local

In Fedora and CentOS, the /etc/ file comes enabled out-of-the-box. For other distributions, you may need to add: /net -hosts to /etc/auto.master.

In addition to NFS, you can also access SAMBA shares under (/smb) in a similar fashion, unless they require authentication.

AutoFS in Ubuntu wiki describes various setup options for AutoFS.


Originally published at on June 26, 2017.

Computer Whisperer. Open-source contributor. Find me at

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store