Wednesday, December 16, 2020

Useful LDAP Commands

 Below are the frequently used ldap commands that will be handful for DBA who is supporting OID.


OID Default LDAP port - 3060

AD Default LDAP port - 389

Query Attrributes for User from AD

ldapsearch -h <AD LDAP Server> -p <LDAP Port> -D "<LDAP User>" -w "<Password>" -W  "dc=domain,dc=com" "sAMAccountName=<Namee>"

Query Attrributes for User from OID

ldapsearch -h <OID LDAP Server> -p <LDAP Port> -D "<LDAP User>" -w "<Password>" -W  "dc=domain,dc=com" "uid=<Namee>"

LDAP Query to list groups assigned to User in OID

$ORACLE_HOME/bin/ldapsearch -h <OID/LDAP Server> -p <LDAP Port> -D "cn=orcladmin" -w "<password>" -b  "dc=domain,dc=com" -s sub "(uniquemember=cn=muthadi\, venkat,cn=users,dc=domain,dc=com)" dn


ADD GROUP TO USER FROM BACKEND in OID
Create LDIF file with attributes as below:
test.ldif
dn: cn=Administrator,cn=groups,dc=domain,dc=com
changetype: modify
add: uniquemember 
uniquemember : cn=muthadi\, venkat,cn=users,dc=domain,dc=com

Then Run below command
ldapmodify  -h <OID/LDAP Server> -p <LDAP Port> -D "cn=orcladmin" -w <password> -v -f test.ldif  

List All Groups in OID
./ldapsearch -x -h <OID/LDAP Server> -p <LDAP Port> -D cn=orcladmin -w <password> -L -b "cn=groups,dc=domain,dc=com" -s one "objectclass=*" dn


I use these regularly in my day to day activities, please feel free to correct or add any things that will be useful for others.



No comments:

Post a Comment

Your Comments on blog are strongly welcomed..