All that's left to do to get an NFS home directory working is to add this record to Open Directory. Open up the Workgroup manager and select the oduser. Delete the current home directory attribute, shown in Figure 13.
Figure 13. Delete Local Home value
Next create a NFSHomeDirectory value of /odhome/oduser as shown in Figure 14.
Figure 14. Create NFSHomeDirectory value
Let's test this out and we're finished. If you do a fast user switch to oduser, and open up a shell and type in
pwd, you will see that you are in /odhome/oduser. If you type
ls -l, you will notice that you have a Library and Desktop folder that are automatically created by OS X when a new account is logged in. Now let's really test this baby out by shelling into our Linux box and seeing if we get the home directory. If you
su - oduser you will notice that if you do a
ls -l that you have the same data, Library and Desktop! Let's send a message to our Mac alter-ego. We'll change into the Desktop and tell the Mac "hi." See Figure 15 for a picture of the commands.
Figure 15. Hi from Linux
Figure 16. oduser sees Hi from Linux
One final thing to keep in mind, if you use OS X with NFS in a group environment you should probably edit this file:
Use the Property List Editor to add the value NSUmask = 2. This binary value will set the umask to 002, which will allow other members of your NFS group to read, write, and execute. The default behavior of the finder is to create files with umask 022, which means group users only have read and execute privileges.
You should probably also set the umask in /etc/profile by adding the line:
Note that a reboot is required for the Finder and the bash shell to get their new respective umask values.
As shown in this article, Open Directory can play with the Unix big boys and integrate quite nicely into an existing NFS infrastructure. NFS is a great alternate choice for OS X Home Directories, as it lets you share a common environment with your Linux and Unix machines. If you work frequently from the shell, you will appreciate the fact that your .bashrc works flawlessly wherever you go.
Noah Gift is the co-author of Python For Unix and Linux by O'Reilly. He is an author, speaker, consultant, and community leader, writing for publications such as IBM Developerworks, Red Hat Magazine, O'Reilly, and MacTech, and Manning.
Return to Mac DevCenter.