Setup NFS Share on Debian

Updated on May 1, 2017
Setup NFS Share on Debian header image

NFS is a network-based file system that allows computers to access files across a computer network. This guide explains how you can expose folders over NFS from one instance to another. Vultr's private network feature assists you with securing the connections between the instances. Please note that you can also expose folders over NFS through the public internet, however, I highly recommend that you use a private network for security purposes. If you are sharing folders in different locations, an encrypted VPN can replace the private network. This guide assumes that both instances are in the same location.


  • Two instances in the same physical location.
  • Debian 7 or newer.
  • Private networking enabled.
  • 10 minutes time.

Private network

Before getting started, ensure that your instances can ping each other and that they both have an unique IP assigned. For example, you can use these commands in order to comply with this article:


ifconfig eth1 up
ip addr add dev eth1


ifconfig eth1 up
ip addr add dev eth1

Once the servers can ping one another, continue on for configuration changes.

Server configuration

The following commands are run on the server-side on which the folder to be exposed is located. First, we start with installing the NFS server.

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

Now we can create the directory which will be exposed.

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

In order to expose the directory over NFS, open the file /etc/exports and attach the following line at the bottom:

/opt/share ,sync,no_subtree_check)

Start the NFS Server.

service nfs-kernel-server restart

Client configuration

We can now continue with mounting the folder on the client.

mkdir /mnt/share
mount /mnt/share

By running df -h, you can ensure that your operation was successful:

root@client> df -h  25.1G  0G  25.1G  0% /mnt/share

Additionally, by creating a file on the client and then checking the server, you will see the file appearing on the server immediately.


NFS is a great way to share files between multiple instances when using a central storage node. Happy hacking!