LDAP: Retrieve all attributes of an objectClass


Use the following syntax to retrieve all attributes required or allowed by an objectClass definition with the following syntax for requested attributes: @objectClassName. The example below provide examples of how to search for entries where:

Retrieve No Attributes

ldapsearch -h localhost -p 1389 \
 -b uid=user.0,ou=people,dc=example,dc=com \
 -s base '(&)' 1.1
dn: uid=user.0,ou=People,dc=example,dc=com

Retrieve All Attributes

ldapsearch -h localhost -p 1389 \
 -b uid=user.0,ou=people,dc=example,dc=com \
 -s base '(&)' 
dn: uid=user.0,ou=People,dc=example,dc=com
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
postalAddress: Aaren Atp$91327 Broadway Street$Las Vegas, UT  08103
postalCode: 08103
uid: user.0
employeeNumber: 0
initials: AWA
givenName: Aaren
pager: +1 214 214 4195
mobile: +1 947 007 3231
cn: Aaren Atp
sn: Atp
telephoneNumber: +1 089 907 9947
street: 91327 Broadway Street
homePhone: +1 457 787 9183
l: Las Vegas
mail: user.0@example.com
st: UT
description: test description 1
uidNumber: 10000
gidNumber: 10000
homeDirectory: /export/home/user.0
loginShell: /bin/bash

Retrieve attributes from the objectClass inetOrgPerson

ldapsearch -h localhost -p 1389 \
 -b uid=user.0,ou=people,dc=example,dc=com \
 -s base '(&)' @inetOrgPerson
dn: uid=user.0,ou=People,dc=example,dc=com
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
postalAddress: Aaren Atp$91327 Broadway Street$Las Vegas, UT  08103
postalCode: 08103
uid: user.0
employeeNumber: 0
initials: AWA
givenName: Aaren
pager: +1 214 214 4195
mobile: +1 947 007 3231
cn: Aaren Atp
sn: Atp
telephoneNumber: +1 089 907 9947
street: 91327 Broadway Street
homePhone: +1 457 787 9183
l: Las Vegas
mail: user.0@example.com
st: UT
description: test description 1

Retrieve attributes from the objectClass posixAccount

ldapsearch -h localhost -p 1389 \
 -b uid=user.0,ou=people,dc=example,dc=com \
 -s base '(&)' @posixAccount
dn: uid=user.0,ou=People,dc=example,dc=com
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: shadowAccount
uid: user.0
cn: Aaren Atp
description: test description 1
uidNumber: 10000
gidNumber: 10000
homeDirectory: /export/home/user.0
loginShell: /bin/bash

References

About Terry Gardner

Terry Gardner was a leading directory services architect with experience with many large scale directory services installations and messaging server installations, and was a Subject Matter Expert in the field of Directory Services and Solaris (operating system) performance. Mr. Gardner also participated in the open-source software community. Mr. Gardner passed away in December, 2013.
This entry was posted in computing, LDAP and tagged , , , , . Bookmark the permalink.

One Response to LDAP: Retrieve all attributes of an objectClass

  1. Pingback: LDAP: Using ldapsearch « Diaries, Triumphs, Failures, and Rants

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s