Example LDAP commands

From Brandonhutchinson.com

(Difference between revisions)
Jump to: navigation, search
Line 5: Line 5:
$ '''ldapsearch -h ''LDAP_server'' -D "cn=Directory Manager" -b "ou=profile,dc=example,dc=com" "objectClass=*"'''
$ '''ldapsearch -h ''LDAP_server'' -D "cn=Directory Manager" -b "ou=profile,dc=example,dc=com" "objectClass=*"'''
-
To delete an LDAP client profile named ''cn=default,ou=profile,dc=example,dc=com''
+
Two ways to delete an LDAP client profile named ''cn=default,ou=profile,dc=example,dc=com''
-
$ '''/usr/bin/printf "dn: cn=default,ou=profile,dc=example,dc=com\n" | ldapdelete -h ''LDAP_server'' -D "cn=Directory Manager"'''
+
$ '''/usr/bin/printf "cn=default,ou=profile,dc=example,dc=com\n" | ldapdelete -h ''LDAP_server'' -D "cn=Directory Manager"'''
$ '''/usr/bin/printf "dn: cn=default,ou=profile,dc=example,dc=com\nchangetype: delete" | ldapmodify -h ''LDAP_server'' -D "cn=Directory Manager"'''
$ '''/usr/bin/printf "dn: cn=default,ou=profile,dc=example,dc=com\nchangetype: delete" | ldapmodify -h ''LDAP_server'' -D "cn=Directory Manager"'''
 +
 +
Modifying the ''defaultServerList'' attribute in the ''simple'' LDAP client profile:
 +
 +
$ '''/usr/bin/printf "dn: cn=simple,ou=profile,dc=example,dc=com\nchangetype: modify\nreplace: defaultServerList\ndefaultServerList: 192.168.1.100 192.168.1.101\n" | ldapmodify -h ''LDAP_server'' -D "cn=Directory Manager"'''

Revision as of 15:24, 19 September 2007

To list the password policy on Sun Directory Server 5.2 and later:

$ ldapsearch -h LDAP_server -D "cn=Directory Manager" -b "cn=Password Policy,cn=config" "objectClass=*"

To list LDAP client profiles on LDAP server:

$ ldapsearch -h LDAP_server -D "cn=Directory Manager" -b "ou=profile,dc=example,dc=com" "objectClass=*"

Two ways to delete an LDAP client profile named cn=default,ou=profile,dc=example,dc=com

$ /usr/bin/printf "cn=default,ou=profile,dc=example,dc=com\n" | ldapdelete -h LDAP_server -D "cn=Directory Manager"
$ /usr/bin/printf "dn: cn=default,ou=profile,dc=example,dc=com\nchangetype: delete" | ldapmodify -h LDAP_server -D "cn=Directory Manager"

Modifying the defaultServerList attribute in the simple LDAP client profile:

$ /usr/bin/printf "dn: cn=simple,ou=profile,dc=example,dc=com\nchangetype: modify\nreplace: defaultServerList\ndefaultServerList: 192.168.1.100 192.168.1.101\n" | ldapmodify -h LDAP_server -D "cn=Directory Manager"
Personal tools