Configuring LDAP Authentication on CentOS6.4

Standard

LDAP Server

yum install openldap openldap-servers openldap-clients
cp /usr/share/openldap-servers/slapd.conf.obsolete /etc/openldap/slapd.conf
slappasswd -s 123456
 
vi /etc/openldap/slapd.conf
  suffix          "dc=example,dc=com"
  rootdn          "cn=admin,dc=example,dc=com"
  rootpw          {SSHA}E5FukcsOBQ7CbIuLJem9aWmO+lc5V1o0
 
cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
 
slapd -f /etc/openldap/slapd.conf
vi user.ldif
 
dn: dc=example, dc=com
objectClass: top
objectClass: dcObject
objectClass: organization
dc: example
o: example, Inc.
 
dn: ou=People,dc=example,dc=com
ou: People
objectClass: top
objectClass: organizationalUnit
 
dn: ou=Group,dc=example,dc=com
ou: Group
objectClass: top
objectClass: organizationalUnit
 
dn: cn=testuser1,ou=Group,dc=example,dc=com
objectClass: posixGroup
objectClass: top
cn: testuser1
userPassword: {crypt}x
gidNumber: 1002
 
dn: cn=testuser2,ou=Group,dc=example,dc=com
objectClass: posixGroup
objectClass: top
cn: testuser2
userPassword: {crypt}x
gidNumber: 1003
 
dn: uid=testuser1,ou=People,dc=example,dc=com
uid: testuser1
cn: testuser1
objectClass: account
objectClass: posixAccount
objectClass: top
userPassword: {SSHA}E5FukcsOBQ7CbIuLJem9aWmO+lc5V1o0
loginShell: /bin/sh
uidNumber: 1002
gidNumber: 1002
homeDirectory: /home/testuser1
 
dn: uid=testuser2,ou=People,dc=example,dc=com
uid: testuser2
cn: testuser2
objectClass: account
objectClass: posixAccount
objectClass: top
userPassword: {SSHA}E5FukcsOBQ7CbIuLJem9aWmO+lc5V1o0
loginShell: /bin/sh
uidNumber: 1003
gidNumber: 1003
homeDirectory: /home/testuser2
:wq
 
ldapadd -x -W -D "cn=admin,dc=example,dc=com" -f user.ldif
 
vi user.modify
dn: uid=testuser1,ou=People,dc=example,dc=com
changetype: modify
replace: loginShell
loginShell: /bin/bash
 
dn: uid=testuser2,ou=People,dc=example,dc=com
changetype: modify
replace: loginShell
loginShell: /bin/bash
:wq
 
ldapmodify -x -W -D "cn=admin,dc=example,dc=com" -f user.modify

LDAP Client

yum install openldap openldap-clients nss-pam-ldapd
authconfig-tui

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.