How to Connect Mac OS X to NFS Shares

Overview

Although SMB is the prefered protocol for connecting Macs to shares, in multi-operating system environments, there are times when you need to connect to an NFS share instead. This tutorial covers guiding you through it on network that does not have central user identity infrastructure, like NIS or LDAP.

Prepare the NFS Share on the Server

We need to create an account for you on the NFS server and then map your OS X user and group ids to it’s. Without this, and unless you have NIS or some other central user database, you will not be able to access the share.

  1. Log onto the NFS server.
  2. Create your user account. We’re going set the User and Group IDs to 5000.
    useradd -u 5000 macusers
  3. Set a password for our NFS user account. Make sure it’s complex.
    passwd macuser
  4. Open the exports file into a text editor, like VI or Nano.
    nano /etc/exports
  5. Add the following line, replacing the highlighted values to match your environment.
    /srv/exports/dept     192.168.1.0/255.255.255.0(rw,all_squash,insecure,anonuid=6000,anongid=6000)
  6. Save your changes and exit the text editor.
  7. Make sure your export has the appropriate permissions. In our example, we need to make macuser the owner and group for it.
    chown -R macuser:macuser /srv/exports/dept

Enable NFS on OS X

Before we can connect to our NFS server we need to enable the NFS service on OS X. Oddly enough, the service doesn’t automatically start when you attempt to make a connection.

  1. Open a Terminal window.
  2. Start the NFS service.
    sudo nfs start
  3. When prompted, enter your password.
  4. Close the Terminal window.

 

Launch Connect to Server

  1. From the Finder menu, click Go
  2. Click Connect to Server from Go’s drop down menu.
  3. Alternatively, you can also press Command+K to launch Connect to Server.

Connect an NFS Share

  1. In the Server Address field, enter nfs:// to define the network protocol for CIFS, and then enter either the IP address or the hostname of the file server with the export path.
    Connect to NFS Server
  2. To add the server to your Favorite Servers list, click the ‘+’ button.
  3. Click Connect to connect to the share.