Skip to content Skip to site navigation

Command Line Clients

Stanford whois Client

Data stored in the LDAP directory can be retrieved using the whois protocol. The whois client is a standard utility installed on Linux and Macintosh systems. The Stanford whois service returns the following information:

  • Contact information for Stanford users marked "Public" in StanfordYou.
  • NetDB host information for campus hosts when the queries originate from campus hosts.

The Stanford developed whois client, swhois, is available on the Stanford time share systems. This client authenticates itself to the Stanford whois service using Kerberos and displays contact information that is marked "Stanford Only" in StanfordYou.

OpenLDAP Clients

Available on all Macintoshes running OS X and on many Linux systems is the ldapsearch command line client. The client supports direct searches of any LDAP standard server. The client supports authenticated Kerberos binds to the directory. An authenticated bind to the directory allows access to data marked as "Stanford Only" in StanfordYou.

Examples

An anonymous search:

% ldapsearch -x -h ldap.stanford.edu -b dc=stanford,dc=edu uid=whm mail
# extended LDIF
#
# LDAPv3
# base  with scope subtree
# filter: uid=whm
# requesting: mail 
#

# 1188e601a61c4d71828acc6e1f80da58, people, stanford.edu
dn: suRegID=1188e601a61c4d71828acc6e1f80da58,cn=people,dc=stanford,dc=edu
mail: whm@stanford.edu

# search result
search: 2
result: 0 Success

# numResponses: 3
# numEntries: 2

An authenticated search:

% ldapsearch -h ldap-dev.stanford.edu -b dc=stanford,dc=edu uid=whm mail
SASL/GSSAPI authentication started
SASL username: whm@stanford.edu
SASL SSF: 56
SASL data security layer installed.
# extended LDIF
#
# LDAPv3
# base  with scope subtree
# filter: uid=whm
# requesting: mail 
#

# whm, accounts, stanford.edu
dn: uid=whm,cn=accounts,dc=stanford,dc=edu

# 1188e601a61c4d71828acc6e1f80da58, people, stanford.edu
dn: suRegID=1188e601a61c4d71828acc6e1f80da58,cn=people,dc=stanford,dc=edu
mail: whm@stanford.edu

# search result
search: 5
result: 0 Success

# numResponses: 3
# numEntries: 2

An authenticated search that limits the values returned for a multi-valued attributes with many values:

% ldapsearch -h ldap-dev -b cn=people,dc=stanford,dc=edu -E 'mv=(cn=*)(suPrivilegeGroup=stanford:*)' "cn=Alisha OHara" uid suPrivilegeGroup
SASL/GSSAPI authentication started
SASL username: whm@stanford.edu
SASL SSF: 56
SASL data security layer installed.
# extended LDIF
#
# LDAPv3
# base  with scope subtree
# filter: cn=Alisha OHara
# requesting: uid suPrivilegeGroup 
# with valuesReturnFilter control: (cn=*)(suPrivilegeGroup=stanford:*)
#

# 1188e601a61c4d71828acc6e1f80da58, people, stanford.edu
dn: suRegID=1188e601a61c4d71828acc6e1f80da58,cn=people,dc=stanford,dc=edu
suPrivilegeGroup: stanford:administrative
suPrivilegeGroup: stanford:staff
suPrivilegeGroup: stanford:stanford

# search result
search: 5
result: 0 Success

# numResponses: 2
# numEntries: 1

A search that suppresses wrapping of the LDIF output:

% ldapsearch -b cn=people,dc=stanford,dc=edu -o ldif-wrap=no uid=whm suGwAffiliation
SASL/GSSAPI authentication started
SASL username: whm@stanford.edu
SASL SSF: 56
SASL data security layer installed.
# extended LDIF
#
# LDAPv3
# base  with scope subtree
# filter: uid=whm
# requesting: suGwAffiliation 
#

# 1188e601a61c4d71828acc6e1f80da58, people, stanford.edu
dn: suRegID=1188e601a61c4d71828acc6e1f80da58,cn=people,dc=stanford,dc=edu
suGwAffiliation: University|Staff|Computing Services|System Software Developer

# search result
search: 5
result: 0 Success

# numResponses: 2
# numEntries: 1
Last modified December 9, 2015