LDAP client configuration with autofs home directories

openLDAP Server installation and configuration step by step guide LDAP client. Autofs is an excellent feature/service to mount to remote NFS shares automatically without running mount command, even from normal users who do not require to have mount command permissions.

LDAP Client configuration

first, install required packages, in this article we will see how to configure LDAP client using CLI interface and GUI Interface

[root@ldapclient1 ~]# yum install -y openldap-clients nss-pam-ldapd sssd authconfig-gtk
[root@ldapclient1 ~]# yum install nfs-utils rpcbind autofs

Using GUI mode

install above packages then enter the command “system-config-authentication

ldap client

Using CLI mode

type command “authconfig-tui

ldap client

Select [*] Use LDAP

select [*] Use LDAP Authentication

click Next

ldap client

provide the ldap server details as shown above and click ok

verify the ldap user information using below command

[root@ldapclient1 ~]# getent passwd ldapuser1
ldapuser1:*:1001:1001:ldapuser1:/home/ldapuser1:/bin/bash

as you see below there is no home directory for ldapuser1

[root@ldapclient1 ~]# su - ldapuser1
su: warning: cannot change directory to /home/ldapuser1: No such file or directory
-bash-4.2$

Now mount user home directory using autofs

edit autofs master configuration file add entry

[root@ldapclient1 ~]# vim /etc/auto.master
#
# Sample auto.master file
# This is a 'master' automounter map and it has the following format:
# mount-point [map-type[,format]:]map [options]
# For details of the format look at auto.master(5).
#
/misc /etc/auto.misc
/home /etc/auto.ldapuser

now create /etc/auto.ldapuser file and add the entry for autofs mount

[root@ldapclient1 ~]# cat /etc/auto.ldapuser
* -rw 192.168.4.15:/home/&

Now restart autofs service

[root@ldapclient1 ~]# systemctl restart autofs
[root@ldapclient1 ~]# systemctl enable autofs
ln -s '/usr/lib/systemd/system/autofs.service' '/etc/systemd/system/multi-user.target.wants/autofs.service'

login using ldapuser then verify you should get ldapuser home directory automatically

[root@ldapclient1 ~]# su - ldapuser1
Last login: Sun Mar 20 00:02:00 IST 2016 on pts/0
[ldapuser1@ldapclient1 ~]$

That’s it your LDAP client is configured successfully with autofs home directory mount

Please provide your valuable feedback

KeyWords: LDAP client configuration, LDAP client home directories using autofs, autofs LDAP client home, LDAP client home directories using autofs, Linux LDAP client, RHEL7 LDAP client

Configure LDAP Server

Wiki

Thanks for your wonderful Support and Encouragement

blank

Ravi Kumar Ankam

My Name is ARK. Expert in grasping any new technology, Interested in Sharing the knowledge. Learn more & Earn More

12 Responses

  1. blank Sreejith says:

    hi urgent help after configuring the ldap server i configured client centos but the problem is client root user can switch to ldapuser and can able to login but i cant able to get to login directly from client shows authentication error i tried the password via ssh it gets login and i can get user detail by getent passwd .but cant able to login . please help me

  2. blank Gopi Kumar says:

    hi , i configured OpenLDAP server and created some of the users , i can access the user account through the Terminal in the Client Machine but the users are not logged in the Client via Gnome , please help me log in the users through the Gnome

  3. blank mkumarjha says:

    Hi kindly share article on primary/secondary ldap

  4. blank omer abdalaziz says:

    hello friend , I am hving this problem also I get user home and information and i can login from root client to any ldap user but from that ldap user to another ldap user it get me authentication failure and I can not login from Gnome after reboot I got users but the authentication failure also I was trying before one month until this moment it didn’t work I don’t know what is the problem it will make me crazy

  5. blank swogat says:

    really good tutorial for ldap configuration.
    Can you post the php authentication and other usages of ldap

  6. blank Rajeswari P says:

    but we want to fetch the users home directories directly from LDAP server without updating /etc/auto.ldapuser file
    how do we do that

  7. blank isuru says:

    woow. this is very clear and understandable . thank you very much

  8. blank Sahil says:

    Can you please help, how we can use client with SSL certificate.

  9. blank Sam says:

    I configured LDAP Server and LDAP client.
    And i have one NFS Server also where in i created nfs export.

    Now when i logged in to the ldap client with one of the ldap user, and try to mount a share , it gives me the error “mount: only root can do that”

    Any help is appreciated.

  10. blank srenu says:

    Hello,Can we login using ssh ldapuser@localhost

Leave a Reply

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