3 Mounting an NFS Share

Describes how to mount an NFS share on a client.

Mounting an NFS share lets the client system access the shared directory over a network as if it was in local storage.

For more information on mounting NFS shares, see the mount(8), nfs(5), and showmount(8) manual pages.

  1. Install nfs-utils.

    If it's not already installed, install the nfs-utils package.

    sudo dnf install nfs-utils
  2. List the NFS server's exported directories.

    Display a list of the directories that the NFS server exports. For example:

    sudo showmount -e host01.mydom.com

    The output of the previous command would be similar to the following:

    Export list for host01.mydom.com
    /var/folder 192.0.2.102
    /usr/local/apps *
    /var/projects/proj1 192.168.1.0/24 mgmtpc

    Note:

    Some servers don't accept querying the list of exports.

  3. Mount an exported directory.

    Mount an exported NFS directory on an available mount point. For example:

    sudo mount -t nfs -r -o nosuid host01.mydoc.com:/usr/local/apps /apps

    This example mounts the /usr/local/apps directory that's exported by host01.mydoc.com with read-only permissions on /apps. The nosuid option prevents remote users from gaining greater privileges by running a setuid program.

    Tip:

    Typically, the -t (or --type) nfs option can be omitted and the mount command guesses the file type.

  4. (Optional) Mount the NFS share when the system boots.

    To configure the system to mount an NFS share at boot time, add an entry for the share to the /etc/fstab file, as shown in the following example:

    host01.mydoc.com:/usr/local/apps      /apps      nfs      ro,nosuid  0 0