Search code examples
active-directoryldapldap-query

What are CN, OU, DC in an LDAP search?


I have a search query in LDAP like this. What exactly does this query mean?

("CN=Dev-India,OU=Distribution Groups,DC=gp,DC=gl,DC=google,DC=com");

Solution

    • CN = Common Name
    • OU = Organizational Unit
    • DC = Domain Component

    These are all parts of the X.500 Directory Specification, which defines nodes in a LDAP directory.

    You can also read up on LDAP data Interchange Format (LDIF), which is an alternate format.

    You read it from right to left, the right-most component is the root of the tree, and the left most component is the node (or leaf) you want to reach.

    Each = pair is a search criteria.

    With your example query

    ("CN=Dev-India,OU=Distribution Groups,DC=gp,DC=gl,DC=google,DC=com");
    

    In effect the query is:

    From the com Domain Component, find the google Domain Component, and then inside it the gl Domain Component and then inside it the gp Domain Component.

    In the gp Domain Component, find the Organizational Unit called Distribution Groups and then find the object that has a common name of Dev-India.