, Automatically mount the NFS share , To automate these manual steps of mounting the share as well as creating the mount directory, a utility named “autofs(5)” can be used. This utility is also not installed per default. To install it, run the following command. , , $ sudo apt-get install autofs , Autofs installs a few configuration files. Among them is the auto.master(5)” configuration file at /etc/auto.master” which needs to be changed. This configuration file contains the master-map for autofs. Open the /etc/auto.master configuration file in your preferred file editor. , , $ sudo vim /etc/auto.master , Add the following line of configuration to the file. The first part (“/media/username/nfs”) defines the mountpoint for the map while the second is the map-file which in this case is “/etc/auto.nfs”. The filename of the map-file can be chosen and will be created later. The rest of this line are options. The “–timeout=30” defines the time (in seconds) until the directory is unmounted after not using it. The “–ghost” option tells autofs to create “ghost” directories (empty directories) of all the mount points listed in the map-file even if they are not mounted. , , /media/username/nfs /etc/auto.nfs --timeout=30 --ghost , Do not end the mointpoint with a slash as it will change the behaviour. With a slash at the end, the directory “/media/username/nfs” will be the mount point of the nfs share not “/media/username/nfs/sharename” as it is supposed to be. , , Now the map-file can be created. Create the file /etc/auto.nfs and open it in your preferred file editor. , , $ sudo vim /etc/auto.nfs , The file may contain one or more lines in the format shown below. Each line may represent a different nfs share to mount. The first part of the line is the mountpoint-key and will be added to the mountpoint of the master-map. In this example, the share below will be available via “/media/username/nfs/sharename”. The second part on this line is the mount-options which are used to mount the share. The third part is the location containing the “hostname” and the “path” to the share separated by colon “:”. , , sharename -fstype=nfs4,rw hostname-or-IP:/sharename , With the share configured in the map-file, autofs can be restarted. Restarting a service in Linux Mint can be done using the following command. , , $ sudo systemctl restart autofs.service ,