NFS Server Configuration...


#!/bin/bash

yum install nfs-utils -y
systemctl start nfs-server.service

echo "share the location where you want to put your sharing folder"
read loc
cd $loc

echo "please suggest me 3 different names to make dir for nfs sharing"
echo "where your 1st dir is for everyone"
echo "2nd dir is for network having 'rw' permissions"
echo "and 3rd dir is for perticuler IP having 'ro' permission"

read name1 name2 name3
mkdir $name1 $name2 $name3
chmod 777 $name1 $name2 $name3
echo "please provide your client network ip"
read netip
echo "please provide your client ip"
read ipaddr
cat >/etc/exports <<EOF
/$name1 *(rw,sync)
/$name2 $netip(rw,async)
/$name3 $ipaddr(ro,async)
EOF
systemctl restart nfs-server.service
firewall-cmd --add-service={nfs,rpc-bind,mountd,nfs3} --permanent
firewall-cmd --reload


No comments:

Post a Comment