Configuring a Base NFS Server

dnf install -y nfs-utils

mkdir -p /nfsdata /home/ldap/ldapuser{1..9}

echo "/nfsdata *(rw,no_root_squash)" >> /etc/exports
echo "/home/ldap *(rw,no_root_squash)" >> /etc/exports
systemctl enable --now nfs-server

for i in nfs mountd rpc-bind; do firewall-cmd --add-service $i --permanent; done

firewall-cmd --reload



Mounting NFS Shares

yum install -y autofs
showmount -e nfsserver
mount nfsserver:/share /mnt
 
 
vi /etc/auto.master
/data /etc/auto.nfsdata
 
 
cat /etc/auto.misc
vi /etc/auto.nfsdata
 
files -rw nfsserver:/nfsdata
* -rw nfsserver:/home/ldap/&
 
systemctl enable --now autofs

Understanding Automount

above commands will crate /etc/nfsdata/files/ directory

nfs_examples

Configuring Automount

Automount for home directories

  • based on the wildcard directories from 1 upto 9 will be available