Sponsored Content
Operating Systems AIX ldapsearch to find DN for a user Post 302440377 by cchart3 on Tuesday 27th of July 2010 04:45:24 AM
Old 07-27-2010
maybe I am missing something. I do not want to put in a DN in the search portion, I am looking for the DN Smilie. Or I am at least looking for OU portiton that is part of the DN, and that part is different for each user.

Also running your query in AIX I get this error:
Code:
scope is required for a null based search.
Sends a search request to an LDAP server.
usage:
    ldapsearch [-b basedn] [options] filter [attributes...]
where:
        basedn:     base dn for search
                    (optional if LDAP_BASEDN set in environment)
        filter:     LDAP search filter
        attributes: whitespace-separated list of attributes to retrieve
                    (if no attribute list is specified, all are retrieved)


Last edited by pludi; 07-27-2010 at 06:05 AM.. 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
URI::ldap(3)						User Contributed Perl Documentation					      URI::ldap(3)

NAME
URI::ldap - LDAP Uniform Resource Locators SYNOPSIS
use URI; $uri = URI->new("ldap:$uri_string"); $dn = $uri->dn; $filter = $uri->filter; @attr = $uri->attributes; $scope = $uri->scope; %extn = $uri->extensions; $uri = URI->new("ldap:"); # start empty $uri->host("ldap.itd.umich.edu"); $uri->dn("o=University of Michigan,c=US"); $uri->attributes(qw(postalAddress)); $uri->scope('sub'); $uri->filter('(cn=Babs Jensen)'); print $uri->as_string," "; DESCRIPTION
"URI::ldap" provides an interface to parse an LDAP URI into its constituent parts and also to build a URI as described in RFC 2255. METHODS
"URI::ldap" supports all the generic and server methods defined by URI, plus the following. Each of the following methods can be used to set or get the value in the URI. The values are passed in unescaped form. None of these return undefined values, but elements without a default can be empty. If arguments are given, then a new value is set for the given part of the URI. $uri->dn( [$new_dn] ) Sets or gets the Distinguished Name part of the URI. The DN identifies the base object of the LDAP search. $uri->attributes( [@new_attrs] ) Sets or gets the list of attribute names which are returned by the search. $uri->scope( [$new_scope] ) Sets or gets the scope to be used by the search. The value can be one of "base", "one" or "sub". If none is given in the URI then the return value defaults to "base". $uri->_scope( [$new_scope] ) Same as scope(), but does not default to anything. $uri->filter( [$new_filter] ) Sets or gets the filter to be used by the search. If none is given in the URI then the return value defaults to "(objectClass=*)". $uri->_filter( [$new_filter] ) Same as filter(), but does not default to anything. $uri->extensions( [$etype => $evalue,...] ) Sets or gets the extensions used for the search. The list passed should be in the form etype1 => evalue1, etype2 => evalue2,... This is also the form of list that is returned. SEE ALSO
<http://tools.ietf.org/html/rfc2255> AUTHOR
Graham Barr <gbarr@pobox.com> Slightly modified by Gisle Aas to fit into the URI distribution. COPYRIGHT
Copyright (c) 1998 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.16.3 2012-02-11 URI::ldap(3)
All times are GMT -4. The time now is 09:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy