zoukankan      html  css  js  c++  java
  • 用ldapsearch验证LDAP认证信息

    企业里面各种各样的系统,堆积多了以后帐号数不胜数,比较好的解决方案之一是用LDAP。不过Microsoft的ActiveDirectory认证是否成功需要有命令来进行验证,可以通过ldapsearch命令。

    首先在Ubuntu上安装:

    apt-get install ldap_utils


    然后该命令就可以运行了。看个例子:

    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"

    这里几个参数解释一下,详细参考文档:  http://linux.die.net/man/1/ldapsearch

    -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的系统服务中。

  • 相关阅读:
    【项目】项目17
    【项目】项目16
    【项目】项目15
    【项目】项目14
    【项目】项目13
    【项目】项目12
    【项目】项目11
    【项目】项目10
    【项目】项目9
    【项目】项目8
  • 原文地址:https://www.cnblogs.com/dyllove98/p/3241525.html
Copyright © 2011-2022 走看看