我们在unix中有一个命令,其中“lsldap -a实体***”
有没有办法在linux中实现相同的功能
答案1
openldap-clients 包有 ldapsearch ,它可以做你想要的事情。从手册页:
LDAPSEARCH(1) 通用命令手册 LDAPSEARCH(1)
名称 ldapsearch - LDAP 搜索工具
概要 ldapsearch [-V[V]] [-d 调试级别] [-n] [-v] [-c] [-u] [-t[t]] [-T 路径] [-F 前缀] [-A ] [-L[L[L]]] [-S 属性] [-b 搜索库] [-s {base|one|sub|children}] [-a {never|always|search|find}] [-l时间限制] [-z 大小限制] [-f 文件] [-M[M]] [-x] [-D binddn] [-W] [-w passwd] [-y passwdfile] [-H ldapuri] [ -h ldaphost] [-p ldapport] [-P {2|3}] [-e [!]ext[=extparam]] [-E [!]ext[=extparam]] [-o opt[=optparam] ] [-O 安全属性] [-I] [-Q] [-N] [-U authcid] [-R 领域] [-X authzid] [-Y mech] [-Z[Z]] 过滤器 [attrs ...]
说明 ldapsearch 是 ldap_search_ext(3) 库调用的 shell 可访问接口。
ldapsearch opens a connection to an LDAP server, binds, and performs a search using specified parameters.
The filter should conform to the string representation for search filters as defined in RFC 4515. If not
provided, the default filter, (objectClass=*), is used.
If ldapsearch finds one or more entries, the attributes specified by attrs are returned. If * is listed,
all user attributes are returned. If + is listed, all operational attributes are returned. If no attrs
are listed, all user attributes are returned. If only 1.1 is listed, no attributes will be returned.
The search results are displayed using an extended version of LDIF. Option -L controls the format of the
output.