Snow Leopard, Ubuntu, LDAP & Automounter Step 5: Setup NFS server & test with automounter

This article is one part in a multi-part series about how to have centralized logins and home directories with Mac OS 10.6 using an Ubuntu 9.10 server, LDAP & Automounter.  You can find the parent article here.

Important Note: Unless stated otherwise, all the commands in this procedure should be run as root.  To become root from a typical admin user, just type sudo su and enter your password.  You can also just stay the regular user and put the word sudo in front of every command.  I’m using to a root prompt and that drives me crazy, so I just su to root.

The Snow Leopard automounter (which is what we need to use for this to work) works with NFS, SMB, & AFP. The way automounter works is you have an “automount” directory, which is really just a reference to an NFS/SMB/AFP network drive.  When you cd to that directory (or login to a user that has that directory listed as it’s home directory), the network share is automatically mounted in the appropriate spot.

Note: This part of the procedure is really going to be based on you, your server, and what directory you want to use for /home.  The best I can do is to show you what I did for mine and you can come up with your own procedure.

I have a directory on the Ubuntu server called /biglun/smbhome (I know the name says smbhome and I’m using NFS.  Ignore that.  These are not the droids you’re looking for.  It’s due to an old config that’s still around.  It’s on my round tuit list to fix that.).  Under that directory are the home directories for each user (in my case, curtis).  My LDAP user entry will say that my home directory is /home/curtis.  I need for automounter to mount nfsserver:/biglun/smbhome when I ask for /home/curtis.

1. Put the filesystem in /etc/exports on the Ubuntu server
   
In my case, I put the following in /etc/exports:

/biglun/sfmbhome *(rw,insecure,sync,no_root_squash,no_subtree_check)

(The insecure option is required for the Macs to mount a Linux NFS share.)

2. Run the exportfs -av command on the Ubuntu server

This tells Linux/Ubuntu to share /biglun/smbhome with read-write access to all clients.  This is very insecure, but it’s my home network.

What I want to do now is to create a basic automounter setup (using text files) to make sure it does what I want, before going through the trouble of adding LDAP to the confusion.

3. Login to the MacOS client that you will be using
 
4. Edit /etc/auto_master and make sure that the following line is uncommented

/home        auto_home

This tells automounter that if anyone asks for anything in /home, then it’s supposed to look at /etc/auto_home to see what to give them.

5. Edit /etc/auto_home and add the following line:

* nfsserver:/biglun/smbhome/&

This tells it if anyone asks for any directory in /home, then mount nfserver:/biglun/smbhome/ as /home/.

6. Run automount -vc to reread the configuration

7. You should now be able to cd to /home/curtis and have it mount nfsserver:/biglun/smbhome/curtis

8. If this works, you should put things back to how they should be for LDAP access.  The only uncommented line in /etc/auto_master shoud be:

+auto_master

This tells it that if anyone asks for any automounter stuff, it’s supposed to ask LDAP for it.  You can leave /etc/auto_home the way it is because it will never be referenced again.  If it bothers you, you can comment out the line you put there. 😉

Now that NFS and automounter are good, the next step is to put the automounter schemas into LDAP.


2 thoughts on “Snow Leopard, Ubuntu, LDAP & Automounter Step 5: Setup NFS server & test with automounter

  1. hh77uu says:

    Dear Curtis,

    Thanks for the useful description. I also have an other question: how should I set the /etc/auto_master and /etc/auto_home files if I want to use an AFP network drive?

    Thanks in advance,

    l.

  2. Guest says:

    Hi,

    When I’m doing this I get an error.
    I’m working with:
    Mac OSx 10.8.4
    a Qnap server -> ubuntu base.
    LDAP server is working only the home dir is a problem.

    Very good tutorial,

    Thnx,

    gtz,

    S.

Leave a Reply

Your email address will not be published. Required fields are marked *