Close this search box.

How to setup NFS Share on Debian

Table of Contents

How to setup NFS Share on Debian


The Network File System, also known as NFS, was created by Sun Microsystems in the early 1980s. As if the remote computer were a local machine, users can access, store, update, and share files on it. NFS offers the convenience of centralized management,


which reduces the need for additional software and disk space for individual users. In a similar way to how users access local files, NFS allows access to files on remote hosts.




  • You need Debian 7 or later.
  • Two machines in the same location.
  • Private networking enabled.


In this article, we’ll demonstrate how to set up an NFS share on Debian. Assign both instances unique IP addresses before starting to ensure that they can ping each other.


Let’s begin,


On Main server


ifconfig eth1 up
ip addr add dev eth1


On client-server


ifconfig eth1 up
ip addr add dev eth1


We now need to configure the main server,


You must execute the following commands on the Main server computer where the folder is located. Let’s first install the NFS server.


apt-get install nfs-kernel-server nfs-common


We can now create the directory,


mkdir /opt/share
chown nobody:nogroup /opt/share
chmod 755 /opt/share


If you want to expose the directory via NFS, navigate to /etc/exports then add the following line.


/opt/share ,sync,no_subtree_check)



Launch the NFS server.


service nfs-kernel-server restart


That’s it!




Let’s configure the Client server,



The folder needs to be mounted on the client now.

mkdir /mnt/share
mount /mnt/share

Use the df -h command to make sure your operation was successful.


Furthermore, if you create a file on the client and then check the server, it appears immediately on the main server.



That’s it!


 VPSie is looking forward to embarking on a new journey with you!.


Remove Webmin from Linux



Get the most out of learning with


 NFS (Network File System) is a protocol allowing a computer to share files and directories over a network.

To set up NFS share on Debian, you can use the following steps:

  1. Install the NFS server package by running the command “sudo apt-get install nfs-kernel-server.”
  2. Create a directory to be shared with NFS by running the command “sudo mkdir /shared_folder.”
  3. Set the permissions and ownership of the shared folder by running the command “sudo chmod -R 777 /shared_folder” and “sudo chown nobody:nogroup /shared_folder.”
  4. Edit the exports file by running the command “sudo nano /etc/exports” and add the following line: “/shared_folder *(rw, sync,no_subtree_check).”
  5. Restart the NFS server by running the command “sudo systemctl restart nfs-kernel-server.”

To mount the NFS share on another computer, use the command “sudo mount server_ip:/shared_folder /local_mount_point.” Replace “server_ip” with the IP address of the computer sharing the NFS folder and “/local_mount_point” with the directory on your local computer where you want to mount the NFS share.

To make the NFS share access to specific IP addresses only, you can modify the export file by adding the IP addresses of the computers allowed to access the NFS share. like, if you want to allow access from IP address only, you can add the following line to the exports file: “/shared_folder, sync,no_subtree_check)”. Save the file and restart the NFS server for the changes to take effect.
Q: How can I check if the NFS share is working correctly? A: To check if the NFS share is working correctly, you can use the command “showmount -e server_ip.” Replace “server_ip” with the computer’s IP address sharing the NFS folder. This command should display a list of shared folders on the NFS server.

To configure NFS to start automatically on boot, you can use the following command: “sudo systemctl enable nfs-kernel-server.” This will enable the NFS server to start automatically when the system boots up.

Make a Comment
Share on
VPSie Cloud service

Fast and Secure Cloud VPS Service

For a month

The First 1 orders gets free discount today! Try Sign up on VPSie to get a chance to get the discount.