Linux LDAP autofs client configuration

There is a plenty of Linux distributions, so there is not my point to describe how to configure autofs in every one of them. This description is based on RedHat/CentOS, but it can be applied to other distributions with very small changes.
If you have local users and their directories located in /home you may want to move their directories to e.g.: /export/home. Then you should change default HOME entry in /etc/default/useradd:

# sed -i "s|/home|/export/home|" /etc/default/useradd

You should also change /etc/passwd entries for these users:

# usermod -m -d /export/home/<username> <username>

or

# sed -i "s|:/home|:/export/home|" /etc/passwd

If /home is separate filesystem, you should umount it, adjust the /etc/fstab and remount this as /export/home.
Check the /etc/autofs.conf for master_map_name, default is:

master_map_name = auto.master

then /etc/auto.master file, it should contain following entry:

+auto.master

plus sign “+” means that the maps will be also read from the external source (NIS, LDAP).
Your LDAP configuration should be already defined in appropriate files (/etc/ldap.conf), please also check /etc/autofs_ldap_auth.conf file if it contains proper settings:

<autofs_ldap_sasl_conf
        usetls="yes"
        tlsrequired="yes"
        authrequired="no"
/>

Now it’s time to add ldap source to /etc/nsswitch.conf:

# grep auto /etc/nsswitch.conf
automount:  files ldap

and start automounter service:

# service autofs start

Now, if you make su - ldapuser or cd /home/ldapdir, automounter should be able to mount user directory from NFS server defined in LDAP.

Useful links:
Using LDAP to Store Automounter Maps
NFS autofs augmenting
AutoFS LDAP
Automount SELinux

You may also like...

Leave a Reply