用ldapsearch验证LDAP认证信息


用ldapsearch验证LDAP认证信息
 
企业里面各种各样的系统,堆积多了以后帐号数不胜数,比较好的解决方案之一是用LDAP。不过Microsoft的ActiveDirectory认证是否成功需要有命令来进行验证,可以通过ldapsearch命令。
 
首先在Ubuntu上安装:
[plain] 
apt-get install ldap_utils  
 
然后该命令就可以运行了。看个例子:
[plain] 
root@gitlab:~# ldapsearch -p 389 -h $ldapHost -D "CN=$firstName $lastName,OU=China,OU=International,OU=Offices,DC=esri,DC=com" -w "$pwd" -b "DC=esri,DC=com" -x "sAMAccountName=$loginName"  
 
-p 端口号
-h LDAP server的域名
-D binddn, 这个需要从LDAP管理员那里获得, 并且注意CN=$firstName $lastName 是你在Active Directory上的用户名称,first name和last name
 binddn
Use the Distinguished Name binddn to bind to the LDAP directory. For SASL binds, the server is expected to ignore this value.
-w 后面跟password,要用""括起来
-b search base,也要从LDAP管理员那里获取
Use searchbase as the starting point for the search instead of the default.
-x 后面接用户名,sAMAccountName不能修改
Use simple authentication instead of SASL.
 
执行后如果获得信息,那么说明配置正确,可以将配置复制到需要连接LDAP的系统服务中。

相关内容

    暂无相关文章