Search Articles   Keywords

Create an NFS Share

Create an NFS Share

  1. 1. Description
  2. 2. Requirements
  3. 3. Server Setup
    1. 3.1. Install required packages
    2. 3.2. Create the Directory that will be Exported
    3. 3.3. Apply permissions
    4. 3.4. Edit the /etc/exports file:
    5. 3.5. Restart the NFS Service
  4. 4. Client Setup
    1. 4.1. Install the required packages
    2. 4.2. Edit the /etc/fstab file
      1. 4.2.1. Auto Mount
      2. 4.2.2. Manual Mount
  5. 5. Sources


This article demonstrates how to configure and connect to an NFS Share.


Server Setup

Install required packages

$ sudo apt install nfs-kernel-server

Create the Directory that will be Exported

$ sudo mkdir -p /export

Apply permissions

Caution: In this example we will be configuring the NFS share to be accessed without authentication.

$ sudo chmod -R 777 /export

Please Note: Setting 777 permissions to a file or directory means that it will be readable, writable, and executable by all users.

Edit the /etc/exports file:

$ sudo nano /etc/exports

The exports file defines which file systems are exported to remote hosts.

To export the folder we just created, add the following two line to /etc/exports file:


This will publish the /export folder on the local subnet,

Restart the NFS Service

To apply the changes, restart the nfs-kernel-server service:

$ sudo systemctl restart nfs-kernel-server

Client Setup

The client configuration is relatively simple.

Follow these steps tp setup and test the NFS Mountpoint on the Client.

Install the required packages

$ sudo apt install nfs-common

Create the directory on the client filesystem where the NFS share will be mounted:

$ sudo mkdir /mnt/<hostname>

Edit the /etc/fstab file

Auto Mount

To ensure the NFS shared folder is mounted by the client on every reboot, add the following line to /etc/fstab:

<nfs-server-IP>:/export /mnt nfs auto 0 0

Manual Mount

If the client will not consistently and reliably have access to the NFS server (i.e. a laptop that connects to multiple private/public networks), then use the noauto option in the /etc/fstab file instead, so that it will ‘‘not’’ automatically try to mount the filesystem at boot.

<nfs-server-IP>:/export /mnt/whitefoot nfs noauto 0 0

In this scenario, the user can manually mount the share using the following command:

$ sudo mount /mnt/whitefoot


[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]

  1. ↩︎

  2. ↩︎

  3. ↩︎

  4. ↩︎

  5. ↩︎

  6. ↩︎

  7. ↩︎

  8. Mounting NFS File Systems with %2Fetc%2Ffstab,-Generally%2C you will&text=The %2Fetc%2Ffstab file contains,the %2Fetc%2Ffstab file. ↩︎

  9. ↩︎

  10. ↩︎

  11. ↩︎

  12. ↩︎