Macs at home; Part 6: NFS server
See the introduction to this post.
Macs can be NFS servers with a little poking. Here’s how to export /Applications to 192.168.1.0/24 without root squashing.
# nicl . -create /exports/\\/ # nicl . -append /exports/\\/ opts maproot=root # nicl . -append /exports/\\/ opts alldirs" # nicl . -append /exports/\\/ opts network=192.168.1.0 # nicl . -append /exports/\\/ opts mask=255.255.255.0
Then you need to start up mountd and nfsd.
# /usr/sbin/mountd # /usr/sbin/nfsd -u -t -n 6
Read the fine manual.
Notes
Now that’s all tremendously exciting but how do you re-export the same filesystem to another subnet? Hmmm. Dunno…
If you change the settings you can HUP mountd. nfsd actually execs a bunch of nfsd-server processes but you don’t need to HUP them.
On reboot things will Just Work because the system will see the exports in NetInfo and start the daemons automatically.
Apparently you can use Kerberos. I’ll have to try that. It does mean compiling NFSv4 on my Slackware machine which I’ve been putting off for about a year now…
Anyway, next time I’m fairly confident I’ll be telling you about apple-mcxflags and apple-mcxsettings.
Update 2007-10-31: On Leopard Apple have obsoleted NetInfo so the above won’t work.