How To Configure NFS File Sharing on Linux Mint 22|21

NFS, short for Network File Share, is a distributed file system protocol that enables mounting of remote directories on one’s server. It enables accessing of files and folders from a remote host and writing to it over a network, in the same way one would access a local storage file. To access data stored on a remote computer (i.e. nsf server) the server would implement NFS daemon processes to make data available to clients. The system administrator then decides what to make available and ensures it can recognize validated clients. The NFS client on the other hand  requests access to exported data by issuing a mount command. If this is successful, the client machine can then view and interact with the file systems within the set parameters.

How do I configure NFS file sharing on Linux Mint? If you are looking at configuring an NFS server on Linux Mint, our today guide will give you a step by step process. We are going to look at how to install and configure NFS server on Linux Mint as well as how to configure NFS client to access the shared directory on the NFS server. We are starting with NFS server.

Step 1: Update packages

I always prefer to have system packages updated before starting any installations.

sudo apt update && sudo apt -y full-upgrade
[ -f /var/run/reboot-required ] && sudo reboot -f

Step 2: Install NFS

To install NFS on the server, run the command as shown:

sudo apt install nfs-kernel-server

Step 3: Create share directory

In this step, we are going to create the directory that will be shared to and accessed by the client machines.

sudo mkdir -p /mnt/nfs_share

To enable the client machines freely access the shared directories, we ought to remove all the permission restrictions on the shared folder.

sudo chown -R nobody:nogroup /mnt/nfs_share
sudo chmod 777 /mnt/nfs_share

Step 4: Grant Clients Access to shared directory

The file /etc/exports defines the parameters of the shared directory, including which machines to access and the permissions they are granted on the directory. Open the file with your preferred editor and make the changes as shown:

sudo vim /etc/exports

In this file, we specify the shared directory, the clients network and client permissions. Once you open the file, add the following content:

/mnt/nfs_share 192.168.30.0/24(rw,sync,no_subtree_check)

Explanation about the options used in the above command.

  • rw: Stands for Read/Write.
  • sync: Requires changes to be written to the disk before they are applied.
  • No_subtree_check: Eliminates subtree checking.

If you wish to grant access to specific single servers instead, specify their IPs separately as shown in /etc/exports file:

/mnt/nfs_share client_ip_1(rw,sync,no_subtree_check)
/mnt/nfs_share client_ip_2(rw,sync,no_subtree_check)

Step 5: Export the shared directory

Having granted access to the client computers, export the NFS share directory and restart the NFS kernel server for the changes to take effect.

sudo exportfs -a
sudo systemctl restart nfs-kernel-server

Step 6: Allow NFS access through the firewall

For the client to access the NFS share, you need to allow access through the firewall otherwise, accessing and mounting the shared directory will be impossible

sudo ufw allow from  192.168.30.0/24 to any port nfs
sudo ufw enable

Step 7: Install NFS client on Client Machines

Having successfully configured NFS server, we can now go ahead to configure NFS clients to access the shared directory.

Update the client package repositories and install nfs-common package.

sudo apt update
sudo apt install nfs-common

We are going to create a directory where we will mount the NFS share from the NFS server.

sudo mkdir -p /mnt/nfs_clientshare

Let’s go ahead to mount the NFS share on the created directory:

sudo mount <nfs-server-ip>:/mnt/nfs_share /mnt/nfs_clientshare

To check if NFS share is working on the client, we are going to write on the server shared directory and check from the client if we can access the same files. On the NFS server, create text files as shown:

cd /mnt/nfs_share
touch test1.txt test2.txt

On the nfs client, check if the files exist:

ls -l /mnt/nfs_clientshare

You should get an output as below:

You have successfully installed NFS server for file sharing on Linux Mint.

Below are more interesting Linux guides:

Join our Linux and open source community. Subscribe to our newsletter for tips, tricks, and collaboration opportunities!

Recent Post

Unlock the Right Solutions with Confidence

At CloudSpinx, we don’t just offer services - we deliver clarity, direction, and results. Whether you're navigating cloud adoption, scaling infrastructure, or solving DevOps challenges, our seasoned experts help you make smart, strategic decisions with total confidence. Let us turn complexity into opportunity and bring your vision to life.

Leave a Comment

Your email address will not be published. Required fields are marked *

Related Post

I recently encountered an error message while trying to download Google Chrome on Windows Server using Internet Explorer browser. In […]

What is Enpass and how can I install Enpass on Ubuntu/ Debian Linux System?. When dealing with a lot of […]

Websploit is an open-source framework for testing websites and networks. It is a simple to use written in Python. It […]

Let's Connect

Unleash the full potential of your business with CloudSpinx. Our expert solutions specialists are standing by to answer your questions and tailor a plan that perfectly aligns with your unique needs.
You will get a response from our solutions specialist within 12 hours
We understand emergencies can be stressful. For immediate assistance, chat with us now

Contact CloudSpinx today!

Download CloudSpinx Profile

Discover the full spectrum of our expertise and services by downloading our detailed Company Profile. Simply enter your first name, last name, and email address.