Linux Guide/LDAP authentication in Linux

From Wikibooks, open books for an open world
< Linux Guide
Jump to: navigation, search

Tested on Fedora Core 4 only

1. Install following RPMs


2. Configure and Start OpenLDAP

  Edit file /etc/openldap/slapd.conf and change 3 settings
  1. suffix  "dc=example,dc=com"
  2. rootdn  "cn=manager,dc=example,dc=com"
  3. rootpw  yourrootpassword
  To Start OpenLDAP run command  service ldap start

3. Use Migration Script to create ldif files from /etc/passwd and /etc/group

Go to directory /usr/share/openldap/migration

edit and change 2 settings

  2. $DEFAULT_BASE = "dc=example,dc=com";

Create 3 ldif files in /root directory with following commands

  ./ /etc/group /root/group.ldif
  ./ /etc/passwd /root/passwd.ldif
  ./ > /root/base.ldif

4. Import ldif files into OpenLDAP

   ldapadd -cx -D "cn=manager,dc=example,dc=com" -w yourrootpassword -f /root/base.ldif
   ldapadd -cx -D "cn=manager,dc=example,dc=com" -w yourrootpassword -f /root/passwd.ldif
   ldapadd -cx -D "cn=manager,dc=example,dc=com" -w yourrootpassword -f /root/group.ldif

5. Use authconfig to configure Linux for ldap authentication

   as root, run command authconfig
   on first screen, select Use LDAP  and Use LDAP Authentication
   On Next screen, Type Server: Base DN: dc=example,dc=com

-Swapnil (Friday, December 09, 2005) Email-