How to share a storage drive on Linux using NFS

Home > Search > How-to


Use the apt-get or yum command to install NFS

~]# yum install nfs-utils



If using iptables, allow NFS.

~]# iptables -I INPUT -p 2049 -j ACCEPT
~]# iptables-save > /etc/sysconfig/iptables


If using Firewalld, allow NFS.

~]# firewall-cmd --add-service=nfs --permanent
~]# firewall-cmd --reload



Let's say you want to share /var/myShare. Edit the /etc/exports file, and add the following. In this example, only a single client is allowed to mount the share, * can be used to allow any client to mount the share.



Export the new addition.

~]# exportfs -a


Start and enable NFS.

~]# systemctl start nfs
~]# systemctl enable nfs
~]# systemctl status nfs


You can now access this share from a different computer in our LAN.

Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter in the box below so that we can be sure you are a human.