|
|
Note: The archives category content is an automatically generated focus channel and does not neccessarily reflect the opinions of this blog. No responsibility is taken for the external links presented here, follow at your own discretion. The archives content is never scraped from sites - but an abstract obtained from search engines.
Category: 'LDAP Beginner Training'
Monday, June 4th, 2007
| Problem |
Solution |
Example |
Reference |
Recommended |
Replace pattern to a given name, etc and filename to LDIF output file. perl -ane '$/="dn" ; print,"\n\n" if($_ =~/pattern/);' filename For example: $ cat user.ldif dn: cn=user0,dc=subdiv,dc=demo,dc=net objectClass: person sn: User cn: user0 userPassword: today321 dn: cn=user1,dc=subdiv,dc=demo,dc=net objectClass: person sn: User cn: user1 userPassword: today321 $ perl -ane '$/="dn" ; print,"\n\n" if($_ =~/user1/);' user.ldif : cn=user1,dc=subdiv,dc=demo,dc=net objectClass: person sn: User cn: user1 userPassword: today321
|
1 Comment »
Saturday, June 2nd, 2007
| Problem |
Solution |
Example |
Reference |
Recommended |
This is how to perform a logical OR LDAP search. ldapsearch -x -v-D"cn=Manager,dc=demo,dc=net"-w secret \ -b"dc=demo,dc=net" "(!(sn=Doe))"
|
1 Comment »
Saturday, June 2nd, 2007
| Problem |
Solution |
Example |
Reference |
Recommended |
This is how to perform a logical AND LDAP search. ldapsearch -x -v-D"cn=Manager,dc=demo,dc=net"-w secret \ -b"dc=demo,dc=net" "(&(givenname=John)(sn=Smith))"
|
1 Comment »
Saturday, June 2nd, 2007
| Problem |
Solution |
Example |
Reference |
Recommended |
This is how to perform a logical OR LDAP search. ldapsearch -x -v-D"cn=Manager,dc=demo,dc=net"-w secret \ -b"dc=demo,dc=net" "(|(sn=Doe)(sn=Smith))"
|
1 Comment »
Saturday, June 2nd, 2007
| Problem |
Solution |
Example |
Reference |
Recommended |
Here is an example of deleting a record in LDAP: ldapdelete -v -D'cn=Manager..' -w ${passwd} \ -h ${host} -p ${port}<<EOT cn=…. EOT Effectively - you just need to supply the full DN. Also be aware you need to delete the lowest branch first, for example: uid=…. sales=…,uid=…. You need to delete sales first, then uid.
|
1 Comment »
Saturday, June 2nd, 2007
| Problem |
Solution |
Example |
Reference |
Recommended |
Here is an example of modifying a record in LDAP, when you need to modify an entry to an existing record: ldapmodify -x -v-D”cn=Manager,dc=demo,dc=net”-w secret<<EOT dn: cn=jdoe,dc=demo,dc=net changetype: modify replace: mail mail: jane.doe@demo.net EOT
|
No Comments »
Saturday, June 2nd, 2007
| Problem |
Solution |
Example |
Reference |
Recommended |
Use ldapmodify from command line. I might seem daunting to start with, but it is the best way. Plus you should perform a search with -L option, to take a backup to file.
|
|
| Problem |
Solution |
Example |
Reference |
Recommended |
Here is an example of modifying a record in LDAP, when you need to add an entry to an existing record: ldapmodify -x -v-D”cn=Manager,dc=demo,dc=net”-w secret<<EOT dn: cn=jdoe,dc=demo,dc=net changetype: modify add: mail mail: mail: john.doe@demo.net EOT Here we are adding the mail field and value.
|
1 Comment »
Saturday, June 2nd, 2007
| Problem |
Solution |
Example |
Reference |
Recommended |
ldapmodify -x -a -v-D”cn=Manager,dc=demo,dc=net”-w secret < ldifFile Where ldifFile is a file either hand crafted or generated with ldapsearch -L.
|
1 Comment »
Monday, May 28th, 2007
| Problem |
Solution |
Example |
Reference |
Recommended |
Searching on two fields and returning those fields, plus email. ldapsearch -x -v-D"cn=Manager,dc=demo,dc=net"-w secret -b'dc=demo,dc=net' -s sub '(&(givenname=John)(sn=Doe))' givenname sn mail
|
No Comments »
Monday, May 28th, 2007
No Comments »
|