带有用户名和密码的ldapsearch

带有用户名和密码的ldapsearch,ldap,ubuntu-14.04,openldap,Ldap,Ubuntu 14.04,Openldap,以下是我的LDAP组织结构: 我创建了一个名为first,姓为password的用户。但是当我尝试使用jdbc连接时,它不起作用。错误提示凭据无效。然后我尝试了ldapsearch,如下所示: 对于用户和组的创建,我遵循以下步骤: root@ip:/home# ldapwhoami SASL/DIGEST-MD5 authentication started Please enter your password: ldap_sasl_interactive_bind_s: Invalid cr

以下是我的LDAP组织结构:

我创建了一个名为first,姓为password的用户。但是当我尝试使用jdbc连接时,它不起作用。错误提示凭据无效。然后我尝试了ldapsearch,如下所示:

对于用户和组的创建,我遵循以下步骤:

root@ip:/home# ldapwhoami
SASL/DIGEST-MD5 authentication started
Please enter your password:
ldap_sasl_interactive_bind_s: Invalid credentials (49)
    additional info: SASL(-13): user not found: no secret in database

root@ip:/# ldapsearch -x -LLL -h ip -D username -w password -b"cn=admin,dc=ivhdev,dc=local" -s sub "(objectClass=*)" "givenName=username*"
ldap_bind: Invalid DN syntax (34)
    additional info: invalid DN

如果我用DN语法传递正确的信息,请建议/纠正我。我无法使用用户名和密码验证用户凭据。

-D选项使用DN登录LDAP服务器

-b
选项获取LDAP树中要搜索用户给定名称的搜索基

因此,您的
ldapsearch
命令变为:

ldapsearch -x -LLL -h ip -D 'cn=admin,dc=ivhdev,dc=local' -w password -b 'dc=users,dc=local' -s sub '(objectClass=*)' 'givenName=username*'

如果使用apachedirectory Studio(),您可以看到应用程序使用的实际ldapsearch命令。可能这对任何人都有用。

它起作用了,我如何使用该命令验证密码正确的用户。如果要验证同一用户的凭据,只需使用上述命令中的用户凭据替换管理员凭据即可。它应该有用。对我有用,但我必须在-D中输入所有用户信息。例如
CN=Lastname\,Firstname M(用户名),OU=Integration,OU=Corp-Ops-enginer\u-Tech,OU=Corporate,OU=Accounts,OU=SPECTR,DC=Corp,DC=companycom,DC=com