Red Hat Enterprise 6Openldap ใน Red Hat Enterprise 6 ได้มีการเปลี่ยน configuration ใหม่ซึ่งทำให้ผู้ที่เคย config Openldap ใน Red Hat Enterprise 5 อาจเกิดอาการมึนงงว่าทำไม่เรา config ไปแล้วแต่ทำไมเวลาใช้คำสั่งต่างๆ เช่น ldapadd, ldapsearch เกิด error “ldapadd ldap_bind: Invalid credentials (49)” บทความนี้ผมจะมาไขข้อข้องใจกันว่าเราจะแก่ไขปัญหานี้อย่างไรดี

Openldap ใน Red Hat Enterprise 6 ได้มีการจัดเก็บไฟล์ config ไว้ใน /etc/openldap/slapd.d/ ซึ่งเป็นการเก็บแบบ configuration tree ถ้าเข้าไปดูอาจเกิดอาการมึนงงได้ว่ามันคืออะไร แล้วจะ config ยังไง แต่ไม่ต้องกังวลเพราะว่าเราจะเอาไฟล์ configuration แบบเก่า (slapd.conf) มา convert ให้เป็น configuration แบบใหม่ที่จะจัดเก็บใน /etc/openldap/slapd.d/ ซึ่งขั้นตอนการทำมีดังนี้

  1. ลบไฟล์ทั้งหมดใน /etc/openldap/slapd.d/ ด้วยคำสั่ง
    [bash][root@ezylinux ~]# rm -rf /etc/openldap/slapd.d/*[/bash]
  2. รัน slaptest เพื่อทดสอบ configuration file และสร้าง configuration ใน directory /etc/openldap/slapd.d/
    [bash][root@ezylinux ~]# slaptest -f /etc/openldap/slapd.conf -F /etc/openldap/slapd.d[/bash]
  3. ตั้งค่า permissions สำหรับไฟล์ configuration ใหม่
    [bash][root@ezylinux ~]# chown -R ldap:ldap /etc/openldap/slapd.d
    [root@ezylinux ~]# chmod -R 000 /etc/openldap/slapd.d
    [root@ezylinux ~]# chmod -R u+rwX /etc/openldap/slapd.d[/bash]
  4. ขั้นตอนสุดท้ายลบหรือเปลี่ยนชื่อไฟล์ slapd.conf

หลังจากเสร็จขั้นตอนทั้งหมดแล้วก็ลอง service slapd start แล้วลองใช้งานได้ตามอัธยาศัยครับ

English version: Red Hat 6: How to fixes ldapadd ldap_bind: Invalid credentials (49)