From fbd45fd0b106d0b268942566d5ae1284abc50733 Mon Sep 17 00:00:00 2001 From: Ibrahim Mkusa Date: Tue, 13 Aug 2024 06:43:26 -0400 Subject: [PATCH] fun with nfs --- nfs/creating_nfs_shares.md | 54 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 nfs/creating_nfs_shares.md diff --git a/nfs/creating_nfs_shares.md b/nfs/creating_nfs_shares.md new file mode 100644 index 0000000..8dbb916 --- /dev/null +++ b/nfs/creating_nfs_shares.md @@ -0,0 +1,54 @@ +** On the Server ** +This documents takes you through setting nfs shares on a fedora family OS. The +core packages that need to be present are =autofs, nfs-utils= +``` +sudo dnf install autofs nfs-utils +``` +Create the directories to share. In this case two folders under the share +directory +``` +mkdir -p /shares/share{1,2} +``` +To tell nfs-server, what folders to share we edit the ==/etc/exports== with the +following lines: +``` +/shares *(rw,no_root_squash) +``` +For more examples on how to edit ==/etc/exports== consult the man page at `man +exports` and navigate to the bottom of the page. +``` +systemctl start nfs-server +systemctl enable nfs-server +``` +Allow external programs access by changing the firewall(nftables). Rpcbind, +mountd, nfs are related services that need access. +``` +for i in rpc-bind mountd nfs; do firewall-cmd --permanent --add-service $i; done; +firewall-cmd --reload +firewall-cmd --list-services # confirm changes +``` + +**On the Client** +Make sure the required packages are installed as seen above. Use ==showmount== +to verify the shared folders. +``` +showmount -e ip_address_server/hostname # verify /etc/hosts in case of issues +``` +Tell autofs the shared folders to mount and the location of their config file. +``` +# in /etc/auto.master +/shares /etc/auto.shares # replaces shares with any file/name +``` +Tell autofs how to mount /shares in /etc/auto.shares +``` +* -rw hostname:/shares/& +``` +Mounts all folders exported thanks to the wildcard character. The ampersand +matches any subdirectory in the ==/shares== + +Start the autofs service +``` +systemctl start autofs +systemctl enable autofs +``` +Confirm folder gets mounted when you navigate to it `cd /shares/`