Tuesday, August 3, 2010

Mac nfs client, Linux nfs server

I have a Mac laptop at work and it's been interesting to play with. We have nfs mounted home directories for our Linux workstations and I thought, hey, my Mac is a UNIX machine, it should be able to mount that nfs export too! Turns out, no, not by default. You get a nice "Operation not permitted" error message. The problem is that Mac nfs clients insist on using high numbered TCP ports, and Linux nfs servers by default insist on rejecting clients that use high numbered TCP ports.

You can tell the Linux server to stop rejecting clients using high numbered ports with the insecure option in /etc/exports, or you can tell your Mac client to stop using high ports with the resvport option to your mount command. Most websites I found while googling for this just listed the Linux nfs server solution, which works fine if you have control over the server. Most people have a lot more control over their client.

For autofs on the Mac, put ,resvport at the end of the /net line in /etc/auto_master, and at the end of the AUTOMOUNTD_MNTOPTS line in /etc/autofs.conf and then restart autofs (I was getting tired of all this at this point and just rebooted my Mac, I'm sure there's a less drastic way to restart autofs).

1 comment:

Dave said...

Hey Bryan,

Nice post! I often see people using NFS with their Macs for shared storage in graphics and 3D workgroups. It seems to be the easiest way to provide consistent network file access across different platforms at a low cost. The Mac is a UNIX machine so we can do the things we're used to doing, but OS X has it's own peculiarities (as you have discovered).

The less drastic way to restart autofs is probably through launchd. You could do something to the tune of:

sudo launchctl unload /System/Library/LaunchDaemons/com.apple.autofsd.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.autofsd.plist

to restart autofsd.

Cheers,
Dave