How to Set up NFS Share on Ubuntu 16.04 LTS

NFS stands for Network File System. This tutorial is going to show you how to configure NFS share on Ubuntu 16.04 so that other computes in your local network can access files and directories on the Ubuntu 16.04 system. We will see how to configure the server side and the client side.

NFS allows directories and file systems to be shared across a local network. NFS can also be set up over the Internet but it’s not secure. In this tutorial, we will set up NFS file share in a home network with two Ubuntu 16.04 computers.

Step 1: Configure the NFS Server

On the first Ubuntu 16.04 computer, install nfs-kernel-server packages.

sudo apt install nfs-kernel-server

Then edit the exports file with nano text editor. The exports files tell NFS server which directories or file systems will be shared to client.

sudo nano /etc/exports

The syntax is as follows

/path/to/directory     client-IP address(options)

For example, you want to share you home directory to the second Ubuntu computer with IP address, then put the following line at the end of the file. Replace username with your actual username. Delimit the two columns with Tab key.


raspbian nfs

Press Ctrl+O to save the file, then CTRL+X to exit out of the file. The IP address of the client computer can be found by running the following command on the client side.


ifconfig find IP address on ubuntu

Step 2: Configure the Client

On the second Ubuntu computer, install nfs-common package.

sudo apt install nfs-common

Then edit /etc/fstab file.

sudo nano /etc/fstab

Add the following line in the file. Replace nfs-server-ip with the IP address of the first Ubuntu computer.

nfs-server-ip:/home/username    /mnt/nfs-share      nfs       rw,soft,intr,noatime,x-gvfs-show

The above line will mount the home directory under /mnt/nfs-share directory in read and write mode. x-gvfs-show option will let you see the shared directory in your file manager.

Save and close the file. Then create the mount point.

sudo mkdir /mnt/nfs-share

Next, run the below command

sudo mount -a

Now you can access the server’s home directory in your file manager.

ubuntu nfs share

If you want to share your home directory with all computers in your home network, then add this line in /etc/exports file, supposing is the IP address of your router.


If you make any changes to /etc/exports file on the server side, then run the below command to tell NFS server to re-read /etc/exports file.

sudo exportfs -ra

That’s it!  If you found this post useful, then subscribe to our free newsletter or follow us on Google+,Twitter or like our Facebook page. Thanks for visiting!

Rate this tutorial
[Total: 16 Average: 4]

6 Responses to “How to Set up NFS Share on Ubuntu 16.04 LTS

  • VaGNaroK Alkimist
    5 years ago

    Thanks for tutorial.

  • Sean Gross
    5 years ago

    I am a fan of Linux Babe, long may she reign

  • Mike DeLorenzo
    3 years ago

    I followed the instructions on both the server and client, but I get an error message on the client saying Unable to mount desktop-home mount: only root can mount….

    I then go to the command line to do sudo mount -a (guessing the above error is because root is not mounting the drive) and I get this error: mount.cfs: access denied by server while mounting

    Any ideas? Thanks!!

    • Mike …
      seems you’re missing a / before home (mount somewhere)

  • thank you very much from France, best website about linux for me

  • Shreyash
    8 months ago


    I am facing the following issue after running sudo mount -a command

    [email protected]:~$ sudo mount -a
    mount.nfs: access denied by server while mounting

    Any idea how to fix it?

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community ( for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.

The maximum upload file size: 2 MB. You can upload: image. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here