Codeschnipsel – Use ldapsearch

ldapsearch ohne Passwort im connect-String. Eine Eingabeaufforderung fürs Passwort wird angezeigt.

user@server:~$ ldapsearch -x -D "user1" -W -H ldaps://ad.example.com -b "OU=Staff,DC=example,DC=com" -LLL -v -s sub "(mailNickname=user1)" | grep -i "^uid\|gid"

  ldap_initialize( ldaps://ad.example.com:636/??base )
  Enter LDAP Password: 

  filter: (mailNickname=user1)
  requesting: All userApplication attributes

  uid: user1
  gidNumber: 12345
  uidNumber: 98765

ldapsearch mit Passwort im connect-String. Die Eingabeaufforderung fürs Passwort fällt weg, die Suche im LDAP beginnt sofort.

user@server:~$ ldapsearch -x -D "user1" -w "password" -H ldaps://ad.example.com -b "OU=Staff,DC=example,DC=com" -LLL -v -s sub "(mailNickname=user1)" | grep -i "^uid\|gid"

  ldap_initialize( ldaps://ad.example.com:636/??base )

  filter: (mailNickname=user1)
  requesting: All userApplication attributes

  uid: user1
  gidNumber: 12345
  uidNumber: 98765