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 perform 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 jukebox.linuxtoys.net, 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 provides read and 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, verify that 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 jukebox.linuxtoys.net, you can type the address: nfs://jukebox.linuxtoys.net/var/music (see Figure 26-5).

    image from book
    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.

Note 

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 the user and 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" jukebox.linuxtoys.net:/var/music /Users/chris/music

The -P says to use a privileged port. Replace jukebox.linuxtoys.net 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 client.




Red Hat Fedora Linux 3 Bible
Red Hat Fedora Linux 3 Bible
ISBN: 0764578723
EAN: 2147483647
Year: 2005
Pages: 286

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net