Sponsored Content
Operating Systems AIX ldapsearch to find DN for a user Post 302440210 by cchart3 on Monday 26th of July 2010 01:05:15 PM
Old 07-26-2010
Data ldapsearch to find DN for a user

How can I do a ldapsearch to find a DN for a user when I know the exact cn for that user out of active directory.

I have tried several different commands (hundreds) but need the -b with the full dn to perform the search using ldapsearch from AIX. I am trying to find the OU for a user and the sAMAccountName. Our user are in several different OU's.

example that works:
Code:
ldapsearch -h something.acorp.com -p 389 -D "cn=${USER},ou=RealOU,DC=something,DC=acorp,DC=com" -w "${PW}" -s sub -b "cn=${SEARCH_USER},ou=UsersRealOU,DC
=something,DC=acorp,DC=com" "cn=*"

example that does not work (one of many):
Code:
ldapsearch -h something.acorp.com -p 389 -D "cn=${USER},ou=RealOU,DC=something,DC=acorp,DC=com" -w "${PW}" -s sub "cn=${SEARCH_USER}"


Last edited by pludi; 07-26-2010 at 04:47 PM.. Reason: code tags, please...
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

ldapsearch and XML

Hello all I would like to know if it's possible to extract users from Active Directory and parse the output to obtain a XML file with specific format. So the AD is a windows machine, and I would like to extract from a red hat linux serveur. I try ldapsearch command and ok I'm abble to extract... (5 Replies)
Discussion started by: ldiaz2106
5 Replies

2. UNIX for Advanced & Expert Users

Counting the ldapsearch results

Hi, Is there way to count the number of results in the ldapsearch, looking at the manpages i dont see an option, Using the following ldapsearch command to list attribute (User-Id=100) under my ObjectClass=my-Process, returns the entries matching the User-Id=100, and the problem i face here is... (0 Replies)
Discussion started by: ennstate
0 Replies

3. Programming

LDAPSEARCH in C

Hi all, I've been searching for ldapsearch function these few days. Still I couldn't found the solution. I would like to translate this query ldapsearch -x -LLL -h new_IP -p new_Port -D "cn=jw" -w "dummy" -b "id=2311,o=WC,c=jp" -s sub to ldap_search_ext_s() function in C program. ... (0 Replies)
Discussion started by: tailangong
0 Replies

4. UNIX for Advanced & Expert Users

ldapsearch to find netgroups which a user belongs to

how to use ldapsearch to find all the netgroups a user belongs to? It's Solaris. (1 Reply)
Discussion started by: jalite19
1 Replies

5. UNIX for Dummies Questions & Answers

Need assistance on using ldapsearch

Never knew of this command ldapsearch, but I would like to use it to lookup a single user and return where their office is. Is this possible? I'm totally starting from scratch. I already saw some of the gurus say read the man page, which is pretty greek when you don't know the details of... (1 Reply)
Discussion started by: srhadden
1 Replies

6. Shell Programming and Scripting

How to find DL Owner info using ldapsearch?

Currently i have following syntax: ldapsearch -D "CN=..,OU=..,OU=All Businesses,DC=..,DC=..,DC=.." -w .. -h .. -p .. -b "OU=All Businesses,DC=..,DC=..,DC=.." "managedObjects=$DL_NAME_CN" employeeNumber givenName sn -S employeeNumber -x which gives me following info: "requesting:... (0 Replies)
Discussion started by: arsenghani
0 Replies

7. Red Hat

Ldapsearch problem

Hi I'm not familiar with ldap and I hope someone to help me. I need to get some attribute value from ldap DB. When i run the following command is OK: ldapsearch -h localhost -p 16611 -x -D cn=user -w passwd -b msisdn=359502479649,dc=MSISDN,DC=C-NTDB "(objectClass=SUBINNSS)" refinmocNAME the... (0 Replies)
Discussion started by: vasil
0 Replies

8. Solaris

Ldapsearch command not exiting

All, New to this forum and unix here so please forgive any silly questions. I am on a Solaris 10 machine and need a script to query our Windows Domain controller to determine if a user is active or not. Man files were helpful enough and it worked. The Challenge is the program doesn't exit... (1 Reply)
Discussion started by: daniel333
1 Replies

9. Shell Programming and Scripting

LDAPSEARCH Return NULL User Attributes

Using ldapsearch to return entries from OID for specific attributes. However, if an attribute is null the field value is not returned. Is there anyway to force ldap to return field names in all cases? LDAP: ldapsearch -T -v -h aaaaa -p 111 -D "cn=orcladmin" -w "xxxx" -L -b... (0 Replies)
Discussion started by: u20sr
0 Replies

10. Shell Programming and Scripting

Find if a User exist if not create user

What I'm trying to do is write a script in Perl to find a user and if that user exist it would print "User Exist, Pls Try Again". If The user doesn't exist I'm able to create a user with a password. Any suggestions? (3 Replies)
Discussion started by: GoBoyGo
3 Replies
OCF_HEARTBEAT_SLAPD(7)						OCF resource agents					    OCF_HEARTBEAT_SLAPD(7)

NAME
ocf_heartbeat_slapd - Manages a Stand-alone LDAP Daemon (slapd) instance SYNOPSIS
slapd [start | stop | monitor | meta-data | validate-all] DESCRIPTION
Resource script for Stand-alone LDAP Daemon (slapd). It manages a slapd instance as an OCF resource. SUPPORTED PARAMETERS
slapd Full path to the slapd binary. For example, "/usr/sbin/slapd". (optional, string, default "/usr/sbin/slapd") ldapsearch Full path to the ldapsearch binary. For example, "/usr/bin/ldapsearch". (optional, string, default "ldapsearch") config Full path to a slapd configuration directory or a slapd configuration file. For example, "/etc/ldap/slapd.d" or "/etc/ldap/slapd.conf". (unique, optional, string, no default) pidfile File to read the PID from; read from olcPidFile/pidfile in config if not set. (optional, string, no default) user User name or id slapd will run with. The group id is also changed to this user's gid, unless the group parameter is used to override. (optional, string, no default) group Group name or id slapd will run with. (optional, string, no default) services LDAP (and other scheme) URLs slapd will serve. For example, "ldap://127.0.0.1:389 ldaps:/// ldapi:///" (unique, optional, string, default "ldap:///") watch_suffix Suffix (database backend) that will be monitored for availability. Multiple suffixes can be specified by providing a space seperated list. By providing one or more suffixes here, the ignore_suffix parameter is discarded. All suffixes will be monitored if left blank. (optional, string, no default) ignore_suffix Suffix (database backend) that will not be monitored for availability. Multiple suffixes can be specified by providing a space seperated list. No suffix will be excluded if left blank. (optional, string, no default) bind_dn Distinguished Name used to bind to the LDAP directory for testing. Leave blank to bind to the LDAP directory anonymously. (optional, string, no default) password Password used to bind to the LDAP directory for testing. (optional, string, no default) parameters slapd may be called with additional parameters. Specify any of them here. (optional, string, no default) stop_escalate Number of seconds to wait for shutdown (using SIGTERM) before resorting to SIGKILL (optional, integer, default 15) SUPPORTED ACTIONS
This resource agent supports the following actions (operations): start Starts the resource. Suggested minimum timeout: 20s. stop Stops the resource. Suggested minimum timeout: 20s. monitor Performs a detailed status check. Suggested minimum timeout: 20s. Suggested interval: 60s. validate-all Performs a validation of the resource configuration. Suggested minimum timeout: 20s. meta-data Retrieves resource agent metadata (internal use only). Suggested minimum timeout: 5s. EXAMPLE
The following is an example configuration for a slapd resource using the crm(8) shell: primitive p_slapd ocf:heartbeat:slapd op monitor depth="0" timeout="20s" interval="60s" SEE ALSO
http://www.linux-ha.org/wiki/slapd_(resource_agent) AUTHOR
Linux-HA contributors (see the resource agent source for information about individual authors) resource-agents UNKNOWN 06/09/2014 OCF_HEARTBEAT_SLAPD(7)
All times are GMT -4. The time now is 01:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy