[UBUNTU] AUTOFS AND NFS UTILS - fourslickz/notes GitHub Wiki

SERVER

apt-get install nfs-utils         #ubuntu 18.04
apt-get install nfs-kernel-server #ubuntu 20.04
mkdir -p /opt/nfs/in
mkdir -p /opt/nfs/out
chown -R nobody:nogroup /opt/nfs
chmod -R 777 /opt/nfs
nano /etc/exports

exports

/opt/nfs        192.168.10.1(rw,sync,no_subtree_check)

CLIENT

apt-get install autofs
nano /etc/autofs.master

autofs.master

#
# Sample auto.master file
# This is a 'master' automounter map and it has the following format:
# mount-point [map-type[,format]:]map [options]
# For details of the format look at auto.master(5).
#
#/misc  /etc/auto.misc
#
# NOTE: mounts done from a hosts map will be mounted with the
#       "nosuid" and "nodev" options unless the "suid" and "dev"
#       options are explicitly given.
#
#/net   -hosts
#
# Include /etc/auto.master.d/*.autofs
# The included files must conform to the format of this file.
#
#+dir:/etc/auto.master.d
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#
#+auto.master

/opt/nfs /etc/auto.nfs --timeout=180

auto.nfs

gate-6  -fstype=nfs,rw,soft,intr  192.168.10.106:/opt/nfs


DEBUGGING use on main server only

mount -t nfs /opt/nfs/gate-6  192.168.10.106:/opt/nfs