Accessing NFS servers from the Mac

Accessing NFS servers from the Mac

For many years, Network File System (NFS) has been the preferred method for sharing files among Linux and other UNIX-like computer systems. Although Mac OS X does support NFS connections from its Connect to Server window, you need to do a little trick on the Linux server for that server to accept connections from the Mac OS X computer.

The following procedure describes how to use the Connect to Server window from a Mac OS X client to access files and directories from a shared Linux NFS server. You can then use the files and directories (also called folders) that reside on the Linux NFS server as though they existed on your Mac OS X computer.

As I've mentioned, the procedure relies on being able to make a small change to how the Linux NFS server offers the shared directory. If you don't have access to the Linux server, you either need to ask the administrator of the Linux server to make the change or connect your Mac to the Linux NFS server manually. (I describe the manual procedure at the end of this section.)

Connecting to NFS from the Connect to Server window

To create an NFS shared directory in Linux and connect to it from a Mac client, do the following:

  1. On the Linux server, export a shared directory using the NFS facility as described in Chapter 18. To be able to use the shared directory from Mac OS X, however, you must be sure to add the insecure option. For example, to share the /var/music directory from the Linux server named, you can add the following line to the /etc/exports file on that server:

    /var/music    *(rw,insecure)

    This example allows the /var/music directory to be shared with all computers (*) and allow read/write permission (rw). The insecure option lets clients that request the exported directory make the request from an insecure port (ports above 1024). This is important because the Mac OS X Connect to Server window makes its request to mount the shared directory from a port above 1024, and fails without the option.

  2. On the Linux server, make sure the the NFS service is running and re-export the shared directory by typing the following (as root user):

    # exportfs -a -v
  3. On the Mac OS X client, select Go in the Finder bar at the top of the screen, and then select Connect to Server. The Connect to Server window appears.

  4. On the Mac OS X client, type the address of the share directory into the Address box. For example, to connect to the shared NFS (nfs://) directory called /var/music from the computer named, you can type the address: nfs://, as shown in Figure 26-5.

    Click To expand
    Figure 26-5: Connect to an NFS server from the Connect to Server window.

If everything is working properly, an icon representing the server should appear on your Mac OS X desktop. Open that icon to see the contents of the shared directory. You can use the shared files and directories as though they were on your Mac (if permissions on the server permits you to do so). Drop the icon in the trash when you are done.


If you are unable to connect to the shared directory, go through the NFS procedures in Chapter 18 more carefully. In particular, make sure that firewall ports are open on the server and that user/host permissions are set to allow the level of access that you require.

Connecting to NFS from the command line

You might very well not have any control over how the Linux NFS server is configured. So if the insecure option isn't set, you will fail to mount an NFS directory from the Mac's Connect to Server window. A possible workaround is to manually mount the NFS directory from Mac OS X and use a secure port. Here's how:

  1. On the Mac OS X computer, gain access to the root user account as follows:

    1. With the Folder icon selected, click Go ? Applications. The Applications folder appears.

    2. Open the Utilities folder, then the Netinfo Manager utility.

    3. Click on the lock icon on the Netinfo Manager window so that it unlocks.

    4. Click Security ? Enable Root User. (If you see a Netinfo error, click OK.)

    5. Type in and verify the new root user password, then click Verify. (Remember that password!)

    6. Click the open lock icon to close it and prevent further changes.

  2. On the Mac OS X computer, click the Terminal icon to open a shell and log in as root:

    # su -
    Password: *******
  3. Create a directory that is accessible to the user account of the person who wants to use the shared NFS directory on the Mac. For example, for the user chris you might type:

    # mkdir /Users/chris/music
    # chown chris /Users/chris/music
  4. Mount the NFS shared directory on the directory you just created. For example:

    # mount -o "-P" /Users/chris/music

The -P says to use a priviledged port. Replace and /var/music with the server's name and the shared directory, respectively. The user can now access /var/music from the /Users/chris/music directory on the Mac OS X.

Part IV: Red Hat Linux Network and Server Setup