LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-27-2024, 09:15 PM   #1
Mo_
Member
 
Registered: Aug 2022
Posts: 50

Rep: Reputation: 0
How to Fix ldap_bind: Invalid credentials (49) error on RHEL9?


Hi Community,
I installed and configured openldap on a server. However, I am getting "ldap_bind: Invalid credentials (49)
" when I run the ldapadd or ldapsearch command. I am a visual learner, so I couldn't find a video about setting up OpenLDAP in RHEL9. I am using the developer version. The documentation I found on the Red Hat website was for RHEL7. I have been reviewing a lot of documentation to configure the LDAP, so I need something else. I tried to configure it a few months ago, then gave up. I started from scratch yesterday. Here are the steps I took.
1. I installed openldap-server
2. There wasn't a DB_CONFIG.example file in /usr/share/openldap-servers/ to copy to /var/lib/ldap/ so I created DB_CONFIG from scratch and changed ownership to ldap. Below is the content of the file.

Code:
# Example DB_CONFIG file for OpenLDAP

# Set the size of the database caches (in bytes)
set_cachesize 0 52428800 1

# Set the maximum size of the database (in bytes)
set_lg_max 10485760

# Set the maximum number of locks
set_lk_max_objects 1500
set_lk_max_locks 1500
set_lk_max_lockers 1500
3. Ran command ldapmodify -Y EXTERNAL -H ldapi:/// -a -f /etc/openldap/schema/cosine.ldif
4. Ran command ldapmodify -Y EXTERNAL -H ldapi:/// -a -f /etc/openldap/schema/nis.ldif
5. Ran command ldapmodify -Y EXTERNAL -H ldapi:/// -a -f /etc/openldap/schema/inetorgperson.ldif
6. Created domain. ldif file and added the contents below
Code:
dn: olcDatabase={2}mdb,cn=config
changetype: modify
replace: olcSuffix
olcSuffix: dc=homelab,dc=local
7. Ran command ldapmodify -Y EXTERNAL -H ldapi:/// -f domain.ldif
8. ran the command "slappasswd -s myPassword"
9. I created the admin_password.ldif file and added the contents below.
Code:
dn: olcDatabase={2}hdb,cn=config
changetype: modify
replace: olcRootPW
olcRootPW: {SSHA}abcdefgh123456789
10. Ran command "ldapmodify -Y EXTERNAL -H ldapi:/// -f admin_password.ldif"
11. started and enabled slapd.service
12. I created the test.ldif and added the contents below. Initially, I didn't add the password.
Code:
dn: dc=homelab,dc=local
objectClass: top
objectClass: dcObject
objectclass: organization
o: Home Lab
dc: homelab

dn: cn=admin,dc=homelab,dc=local
objectClass: organizationalRole
cn: admin
description: LDAP administrator
userPassword: {SSHA}abcdefgh123456789
13.With is this command ldapadd -x -D cn=admin,dc=homelab,dc=local -W -f test.ldif I am getting the below error.
Code:
[root@ldap openldap]# ldapadd -x -D cn=admin,dc=homelab,dc=local -W -f /etc/openldap/test.ldif
Enter LDAP Password:
ldap_bind: Invalid credentials (49)
I updated the password and added an updated hash to the file. I thought I mistyped the password initially, but I'm still getting the error. I get the same error if I run "ldapsearch -x -D "cn=admin,dc=homelab,dc=local" -W -b "dc=homelab,dc=local" -H ldapi:///."I exhausted all of my options and can't figure it out. Though I wrote down all of the above steps yesterday, today I reset the server and started again, but still getting same error. I am including log file information. Do you happen to know what the issue could be? Appreciate your help!

Code:
Apr 27 09:39:49 ldap-server-01 slapd[3938]: conn=1009 fd=13 ACCEPT from IP=[::1]:50366 (IP=[::]:389)
Apr 27 09:39:49 ldap-server-01 slapd[3938]: conn=1009 op=0 BIND dn="cn=admin,dc=homelab,dc=local" method=128
Apr 27 09:39:49 ldap-server-01 slapd[3938]: conn=1009 op=0 RESULT tag=97 err=49 qtime=0.000060 etime=0.002148 text=
Apr 27 09:39:49 ldap-server-01 slapd[3938]: conn=1009 op=1 UNBIND
Apr 27 09:39:49 ldap-server-01 slapd[3938]: conn=1009 fd=13 closed
Apr 27 09:40:05 ldap-server-01 slapd[3938]: conn=1010 fd=13 ACCEPT from PATH=/var/run/ldapi (PATH=/var/run/ldapi)
Apr 27 09:40:05 ldap-server-01 slapd[3938]: conn=1010 op=0 BIND dn="cn=admin,dc=homelab,dc=local" method=128
Apr 27 09:40:05 ldap-server-01 slapd[3938]: conn=1010 op=0 RESULT tag=97 err=49 qtime=0.000076 etime=0.002036 text=
Apr 27 09:40:05 ldap-server-01 slapd[3938]: conn=1010 op=1 UNBIND
Apr 27 09:40:05 ldap-server-01 slapd[3938]: conn=1010 fd=13 closed
 
  


Reply

Tags
ldap, linux, openldap, server



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] getting error while adding account in LDAP "ldap_bind: Invalid credentials (49)" csravi88 Linux - Server 6 10-14-2013 07:43 AM
Getting ldap_bind : Invalid credentials(49) error Rohit_4739 Linux - Server 4 03-15-2013 12:29 PM
[SOLVED] openldap error "ldap_bind: Invalid credentials (49)" pantdk Linux - Server 4 11-24-2011 04:07 PM
ldap_bind:Invalid credentials chintone Linux - General 0 12-06-2002 05:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration