22.4.6 Adding an Automount Map to LDAP

You can make an automount map such as auto.home available in LDAP so that the automounter mounts a user's home directory on demand.

To add the auto.home map to LDAP:

  1. Create an LDIF file that defines entries for the map's name and its contents, for example auto-home.ldif:

    dn: nisMapName=auto.home,dc=mydom,dc=com
    objectClass: top
    objectClass: nisMap
    nisMapName: auto.home
    
    dn: cn=*,nisMapName=auto.home,dc=mydom,dc=com
    objectClass: nisObject
    cn: *
    nisMapEntry: -rw,sync nfssvr:/nethome/&
    nisMapName: auto.home

    where nfssvr is the host name or IP address of the NFS server that exports the users' home directories.

  2. If you have configured LDAP authentication, use the following command to add the map to LDAP:

    # ldapadd -xcWD "cn=admin,dc=mydom,dc=com" \
      -f auto-home.ldif
    Enter LDAP Password: user_password
    adding new entry "nisMapName=auto.home,dc=mydom,dc=com"
    
    adding new entry "cn=*,nisMapName=auto.home,dc=mydom,dc=com"

    If you have configured Kerberos authentication, use kinit to obtain a ticket granting ticket (TGT) for the admin principal, and use this form of the command:

    # ldapmodify -f auto-home.ldif
  3. Verify that the map appears in LDAP:

    # ldapsearch -LLL -x -b "dc=mydom,dc=com" nisMapName=auto.home
    dn: nisMapName=auto.home,dc=mydom,dc=com
    objectClass: top
    objectClass: nisMap
    nisMapName: auto.home
    
    dn: cn=*,nisMapName=auto.home,dc=mydom,dc=com
    objectClass: nisObject
    cn: *
    nisMapEntry: -rw,sync nfssvr.mydom.com:/nethome/&
    nisMapName: auto.home