Work in progress

This site is in the process of being reviewed and updated.

Introduction

Automount allows users to automatically mount shares as needed. Shares may be home directories or public storage. With NFSv4 we can use Kerberos to provide single sign-on access to user shares. In the following examples, we host our home directories on ldap1.example.com and share /home. The file server and Apache Directory do not need to run on the same machine.

Here is the line from /etc/exports that works to export home directories:

/home *.example.com(rw)

Linux LDAP clients mount the user's home directory at login, using automount and NFSv4. We need to configure the automount maps in ou's for auto.master, auto.home, and auto.misc. We start with a new organizational unit for auto.master:

dn: ou=auto.master,dc=example,dc=com
objectClass: top
objectClass: automountMap
ou: auto.master

An auto.master entry is identified by 'common name' (cn). The automountInformation attribute instructs automount to look for a map elsewhere in the directory:

dn: cn=/h,ou=auto.master,dc=example,dc=com
objectClass: automount
automountInformation: ldap:ou=auto.home,dc=example,dc=com
cn: /h

We can also create an auto.master entry for other NFSv4 shared directories:

dn: cn=/share,ou=auto.master,dc=example,dc=com
objectClass: automount
automountInformation: ldap:ou=auto.misc,dc=example,dc=com
cn: /share

We create the automount entries in LDIF format, save them as auto.master.ldif, and add the entries via an LDAP add operation:

ldapadd -x -D 'uid=admin,ou=system' -W -f auto.master.ldif

Next, we create a new organizational unit for auto.home:

dn:ou=auto.home,dc=example,dc=com
objectClass: top
objectClass: automountMap
ou: auto.home

A home directory entry is also identified by cn.

dn: cn=hnelson,ou=auto.home,dc=example,dc=com
objectClass: automount
automountInformation: ldap1.example.com:/home/hnelson
cn: hnelson

Create auto.home entries for each user in ldif format, save as auto.home.ldif and add the entries to LDAP:

ldapadd -x -D 'uid=admin,ou=system' -W -f auto.home.ldif

When automounted from a Linux LDAP client, your home directory, ldap1.example.com:/home/hnelson, is mounted on /h/hnelson. Other NFSv4 shares may be entered in LDAP and automounted as needed. The auto.misc organizational unit holds these automount maps, which have the form ou=auto.misc.

We've already created an auto.master entry for /share, as shown above. Now, we create the ou=auto.misc entry:

dn:ou=auto.misc,dc=example,dc=com
ou: auto.misc
objectClass: top
objectClass: automountMap

Create entries for the NFSv4 shares under ou=auto.misc:

dn:cn=users,ou=auto.misc,dc=example,dc=com
objectClass: automount
automountInformation: nfs1.example.com:/pub/users
cn: users
dn:cn=public,ou=auto.misc,dc=example,dc=com
objectClass: automount
automountInformation: nfs1.example.com:/data/public
cn: public

Save the entries as auto.misc.ldif and add the entries to LDAP:

ldapadd -x -D 'uid=admin,ou=system' -W -f auto.misc.ldif

When automounted from a Linux LDAP client, your shared directory nfs1.example.com:/data/public is mounted on /share/public.

To test, log in to a Linux LDAP client using an LDAP user name. You should see the appropriate login shell and home directory for the user. To test auto.misc shares, you must access the share by name, for example:

cd /share/public
  • No labels