apt-get install ldap-utils

LdapSearch examples

The following examples are taking from various ldapsearch queries on Small Business Server 2003.

Get a user from Active Directory

ldapsearch -x -LLL -D 'CN=Administrator,CN=Users,DC=Domain,DC=local' -W -H ldap://ad.example.com:389 -b 'OU=SBSUsers,OU=Users,OU=MyBusiness,DC=Domain,DC=local' -s sub '(sAMAccountName=jean-kevin)'

the “-x” switch enables simple authentication, instead of SASL
-LLL is just a display switch, to get LDIF information only, without comments
-D is the DN of the user used to bind to the LDAP server, -W will prompt for password on the command line
-H is the address of the LDAP server
-b is the base of the search (where it will start), can be anywhere in the tree. Lower is better to filter the search.
-s sub indicates we want to search in the leaves
the last parameter is the filter in ldap filter format
Get the security groups a user is a member of

ldapsearch -x -LLL -D 'CN=Administrator,CN=Users,DC=Domain,DC=local' -W -H ldap://ad.example.com:389 -b 'OU=Security Groups,OU=MyBusiness,DC=Domain,DC=local' -s sub '(&(objectClass=group)(member=CN=Jean-Kevin De La Motte,OU=SBSUsers,OU=Users,OU=MyBusiness,DC=Domain,DC=local))'

Linux下LDAPSearch的例子的更多相关文章

  1. Linux下如何启用MySQL数据库远程访问

    远程连接MySQL出于安全考虑,一般都关闭了远程访问,但有时候需要提供远程访问数据库的服务,下面我们快速学习下: 第一步:修改my.cnf文件使用文本编辑器去编辑MySQL服务器的配置文件my.cnf ...

  2. linux下编译eXosip、osip,以及UAC和UAS的例子

    从网站上看到了这样的一篇博文 :Windows下编译eXosip.osip,以及UAC和UAS的例子 (链接:http://www.cnblogs.com/dyllove98/archive/2013 ...

  3. linux下堆溢出unlink的一个简单例子及利用

    最近认真学习了下linux下堆的管理及堆溢出利用,做下笔记:作者作为初学者,如果有什么写的不对的地方而您又碰巧看到,欢迎指正. 本文用到的例子下载链接https://github.com/ctfs/w ...

  4. linux下查看动态链接库依赖关系的命令 x86: ldd *.so arm: arm-linux-readelf -d *.so 实际例子: 以项目中用到的库librtsp.so分析: lijun@ubuntu:~/workspace$ arm-hisiv100nptl-linux-ld -d librtsp.so arm-hisiv100nptl-linux-ld:

    linux下查看动态链接库依赖关系的命令 x86:ldd    *.so arm:arm-linux-readelf    -d    *.so 实际例子:以项目中用到的库librtsp.so分析:l ...

  5. Linux下libaio的一个简单例子

    转载:http://www.cnblogs.com/aLittleBitCool/archive/2011/10/18/2216646.html 异步io,很好玩的一个东西,从接口来看,封装的比较厉害 ...

  6. linux下的C语言开发 进程创建 延伸的几个例子

    在Linux下面,创建进程是一件十分有意思的事情.我们都知道,进程是操作系统下面享有资源的基本单位.那么,在linux下面应该怎么创建进程呢?其实非常简单,一个fork函数就可以搞定了.但是,我们需要 ...

  7. Linux下服务器端开发流程及相关工具介绍(C++)

    去年刚毕业来公司后,做为新人,发现很多东西都没有文档,各种工具和地址都是口口相传的,而且很多时候都是不知道有哪些工具可以使用,所以当时就想把自己接触到的这些东西记录下来,为后来者提供参考,相当于一个路 ...

  8. Linux下的C Socket编程 -- server端的继续研究

    Linux下的C Socket编程(四) 延长server的生命周期 在前面的一个个例子中,server在处理完一个连接后便会立即结束掉自己,然而这种server并不科学啊,server应该是能够一直 ...

  9. 我将系统从Windows迁移至Linux下的点点滴滴

    一.写在最前 由于本人的技术水平有限,难免会出现错误.本文对任何一个人有帮助都是我莫大的荣幸,任何一个大神对我的点拨,我都会感激不尽. 二.技术选型 在2013年8月低的时候,公司中了XXX市场监督局 ...

随机推荐

  1. Java for LeetCode 155 Min Stack

    Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. pu ...

  2. Java for LeetCode 069 Sqrt(x)

    Implement int sqrt(int x). Compute and return the square root of x. 解题思路一: public int mySqrt(int x) ...

  3. 2.django笔记之缓存,session,cookie,ajax

    一.django缓存 1.缓存 缓存的意义在于把昂贵的计算结果保存起来一遍下次的访问,有缓存的站点的流程大概是这样子的: 给定一个url,检查页面是否在缓存中 如果在,返回缓存的页面 否则,生成该页面 ...

  4. [Android Memory] App调试内存泄露之Context篇(上)

    转载自:http://www.cnblogs.com/qianxudetianxia/p/3645106.html Context作为最基本的上下文,承载着Activity,Service等最基本组件 ...

  5. struts1老古董配置

    <!--Struts1 struts-config.xml Demo --><?xml version="1.0" encoding="UTF-8&qu ...

  6. xampp 访问出现New XAMPP security concept

    在浏览器输入 http://60.10.140.22/xampp出现以下错误信息: Access forbidden! New XAMPP security concept: Access to th ...

  7. GRE红宝书5-6

    page5 adopt: adoration: adore:   --ore讲话, oration演讲 adorn:   orn表示装饰, ornate adulation:      adulate ...

  8. Effective C++笔记:实现

    条款26:尽可能延后变量定义式的出现时间 博客地址:http://www.cnblogs.com/ronny/ 转载请注明出处! 有些对象,你可能过早的定义它,而在代码执行的过程中发生了导常,造成了开 ...

  9. 4KB对齐

    4KB是固态硬盘的读写基本block size的大小也就是说读写的基本单位是4KB,哪怕1B的内容读写实际操作也是操作了4KB的块实际操作是以块为单位的 假设我的读写起始点刚好定在两个4KB大小的物理 ...

  10. kinect学习笔记(二)—— Sdk平台的搭建~、

    一.资源下载        由于我们使用的kinect v1.0,所以我们只需要使用1.8版本的sdk就好了,然后资源包,在QQ群的共享里面已经有啦,所以大家可以直接下载. 二.软件安装        ...