Python LDAP "Can' t 联系 LDAP 服务器”

标签 python ldap

我正在尝试使用以下代码在本地主机上运行 LDAP 服务器:

import ldap
l = ldap.initialize('ldap://127.0.0.1')
l.protocol_version = ldap.VERSION3
USERNAME = "cn=admin,dc=example,dc=org"
PASSWORD = "pass"
l.simple_bind_s(USERNAME, PASSWORD)

我收到错误:“无法联系 LDAP 服务器”

最佳答案

您没有通过代码运行 LDAP 服务器,您正在尝试连接到现有 LDAP 服务器。

您必须在计算机上设置并运行 LDAP 服务器然后连接到它。

就像 Windows 上的 open-ldap 一样:
OpenLdap

或对于 Ubuntu (Linux):
Create OpenLdap on Ubuntu

如果有现有服务器,您必须输入正确的 IP 地址

关于Python LDAP "Can' t 联系 LDAP 服务器”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33775418/

相关文章:

Python 子进程 : in which case a segfault program returns -11 or 139?

python - 运行由字符串定义的类的特定方法

python - LDAP gidNumber 类似自动整数

java - OSGi 春分 : howto add protocol handler for LDAP?

c# - 如何在 LDAP 中进行身份验证?

python - threading.Thread 如何在 Python 中产生剩余的量子?

python - 关闭 SIG* 上的 SocketServer

python - OpenERP 6,Aptana - 调试器不会在 QR 条形码标签代码中的断点处停止

java - 我如何使用 ldap 和 spring security 获取登录用户的电子邮件

c - 如何在 WinLDAP 中使用 ldap_sasl_bind?