Share Ubuntu folders with NFS

Jack Wallen
Mar 1, 2010
Updated • Nov 28, 2012

If you've ever tried to share folders on a Linux machine over a network, you've most likely attempted to get NFS working. And on many occasions you might have found yourself nearly pulling out your hair in frustration. Well, you'll be glad to know that getting NFS working on modern Ubuntu systems is actually quite simple. You just have to have a couple of pieces installed and access to the /etc/exports file.

In this article I am going to demonstrate how simple it is to share a folder, using NFS, between a Ubuntu machine and a Debian machine. When all is said and done, you'll be surprised at how simple it is.

What is NFS?

NFS stands for (take a guess...) Network File System. NFS is a protocol developed by Sun Microsystems in 1984 to allow computers to share files and folders over a network. NFS is an open standard, defined in RFCs, and allows any to implement the protocol.

Although many prefer to employ Samba for network folder sharing, NFS still has a lot of good uses and some even prefer it over the more flexible Samba.


Both client and server will need the package nfs-common. On the server machine you will need to install the package nfs-kernel-server. To install these packages follow these steps:

  1. Open up Synaptic (or your favorite Add/Remove Program utility).
  2. Search for "nfs" (no quotes).
  3. Mark nfs-common (for the client) and nsf-common and nfs-kernel-server (for the server).
  4. Click Apply to install.

That's it. Now it's time for a little configuration.


For example's sake, the two machines we are using are addressed as such:



On the client we will create a directory which the NFS server share will mounted to. We'll create the folder ~/UBUNTU_NFS with the command mkdir ~/UBUNTU_NFS. Now let's move over to the server.

The first thing to be done on the server machine is to create folder that will be shared out. Let's call that folder ~/SHARE and we'll create it with the command mkdir ~/SHARE.

Now we have to create an entry in the /etc/exports folder. This entry will tell NFS what to share and who to share with. The entry will look like:


Where USERNAME is the actual name of the user. NOTE: You could share a folder in /opt if you like.

Now nfs-kernel-server has to be restarted with the command:

/etc/init.d/nfs-kernel-server restart


Hop back on to the client machine and issue the command:

sudo mount /home/USER/UBUNTU_NFS

Where USER is the actual user name.

You should get no errors. Now let's test this out. Hop on back to the server and create a file within ~/SHARE. After you create that file, check the ~/UBUNTU_NFS directory on the client to make sure the file shows up. Try to delete that file. Now create a file in the ~/UBUNTU_NFS directory on the client. You should have no problems creating a file.


Say you want this share to always be mounted upon boot of the client machine. This, of course would require the server machine to be on. To do this add an entry on the client machine's /etc/fstab that looks like:  /home/jlwallen/UBUNTU  nfs rsize=1024,wsize=1024,noauto 0 0

NOTE: The above fstab entry is all one line.

Now that NFS share will mount even when the machine is rebooted.

Final thoughts

As you can see, NFS has become much easier than it was in the old days. Now, armed with NFS and Samba, you can be sharing files and folders with anyone and everyone.


Previous Post: «
Next Post: «


  1. Manny Castillo said on September 29, 2011 at 12:07 am

    Is sharing transitive?

    What I mean is,
    lets say I have a nfs server on PC A
    and I am sharing it on PC B
    can I then make PC B an nfs server as well and share that shared folder with PC C

    PC A PC B PC C

    p.s. your guide worked except i had to remove “noauto” from your fstab configuration… why is noauto even there if our goal is to automount? :)

  2. dwagonfwy said on February 4, 2011 at 8:57 am

    nice one. much more concise than all of the other convoluted, “official” guides floating about.

  3. a said on July 21, 2010 at 12:16 am

    Dirt simple share. Thanks

  4. prupert said on March 1, 2010 at 9:27 pm

    Awesome, thanks Jack ;)

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.