UPDATE (Aug 7th, 2009): three years after I wrote this, I see that this post is still generating traffic. I just wanted to note that in OS X 10.5, there is a little trick you can play using the command line. Let’s say that your NFS server is named something like myfilesrv
. Assuming it’s exporting things correctly, try this:
cd /net/myfilesrv
ls
The OS will automatically create a myfileserv
directory and mount all exported directories. Knowing that, we can set up a convenient symbolic link:
ln -s /net/myfilesrv/mystorage/mymusic ~/Desktop/mymusic
That would give you a folder on your desktop that jumps you right into a networked music directory (obviously you’d need to replace myfilesrv/mystorage/mymusic
with your own server name and directory structure). However, I think that the NFS server needs to export using the insecure
option for this to work properly.
Now back to the original post…
As a disclaimer, I am only just learning the ins and outs of Mac OS X. While the operating system does have a UNIX base, there are quite a few things that take me far outside my Linux comfort zone. Today I learned that mounting an NFS export on a Mac OS X file system was not as easy as I thought it would be. Searching Google, I found a confusing number of methods, both through the GUI and the command line, to mount an NFS directory. Further adding to my confusion was that some of these methods were not consistent or persistent across different versions of OS X. In the end, I found a method that worked for my specific situation, though I can give no guarantee that it is the optimal method.
EXPORTING THE DIRECTORY
Here is the line from /etc/exports
that shows what I am exporting:
/exports/csagan csagan.pale.blue(rw,sync,all_squash,anonuid=504,anongid=101)
Basically, I want to make /exports/csagan
available to the Mac named csagan.pale.blue
. Unfortunately, csagan.pale.blue
is not set up to be part of my NIS domain and so the user in question has neither the appropriate uid nor gid to match the permissions on /exports/csagan
. As you can see, I set the export options so that requests from csagan.pale.blue
get mapped to the correct uid and gid.
MOUNTING THE NFS EXPORT
At first I tried using Mac’s “Finder” to get to the exported directory. The only way I got this to work was by adding the insecure
option to the line in /etc/exports
. I could not seem to write to the directory when I did this, nor did I feel comfortable utilizing an option having the dubious name of “insecure”. I scrapped that idea and wound up using Mac’s “NetInfo Manager” which can be found in Applications/Utilities
. This excellent tutorial shows how to use NetInfo Manager (among several other methods) to mount the directory.
NOTE: the aforementioned tutorial has its own “NOTE:” at the bottom of the document. Be sure to read this note; I didn’t notice it initially and was left wondering why the hell nothing was working. Basically, my version of OS X ignores the “dir” option and mounts the export in the /Network/Servers
directory.
I always find it frustrating when someone references a link to important information and then clicking that link leads to a 404 or some other error. Therefore, here is an alternative tutorial and one more just in case.
NETWORK FILE SERVE AWAY!
Now everything seems to be in working order. Because the uid/gid gets squashed to the correct ones on the server, permissions shouldn’t be a big deal. Initially, I had trouble writing to the NFS export, but I eventually realized that I had inadvertently swapped the values for anonuid and anongid. Of course, I realized this after I went through the process of changing the Mac user’s uid which involved enabling the root user. Hopefully my next excursion into the strange, magical land of Apple will not be frought with so many worms.