Administration
  Home arrow Administration arrow Page 7 - Understanding LDAP (part 2)
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Forums Sitemap 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
ADMINISTRATION

Understanding LDAP (part 2)
By: icarus, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 14
    2003-03-05


    Table of Contents:
  • Understanding LDAP (part 2)
  • Opening Up
  • Building Blocks
  • The Root Of All Evil
  • A Little Black Book Is Born
  • Digging Deep
  • Changing Things Around
  • You Have Mail
  • Link Zone

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Understanding LDAP (part 2) - Changing Things Around
    (Page 7 of 9 )

    Now, how about editing entries in the database? LDAP allows you to do this via the "ldapmodify" command, as demonstrated in the following example:
    
    [root@olympus] $ /usr/local/openldap/bin/ldapmodify -x -D
    "cn=root,dc=melonfire,dc=com" -W
    You'll be prompted for the password - enter it, and then enter the DN for the record being edited, followed by the new attribute-value pairs:
    
    dn: mail=sarah@melonfire-mail.com, dc=melonfire, dc=com
    sn: Jones
    modifying entry "mail=sarah@melonfire-mail.com,dc=melonfire,dc=com"
    
    Now, when you check the database again with "ldapsearch"
    
    [root@olympus] $ /usr/local/openldap/bin/ldapsearch -b 'dc=melonfire,dc=com''(cn=Sarah)'
    you'll see the revised entry:
    
    # extended LDIF## LDAPv3# base <dc=melonfire,dc=com> with scope sub# filter: (cn=Sarah)# requesting: ALL## sarah@melonfire-mail.com, melonfire.comdn: mail=sarah@melonfire-mail.com,dc=melonfire,dc=comobjectClass: inetOrgPersoncn: Sarahmail: sarah@melonfire-mail.comtelephoneNumber: 23 67 128 5639sn: Nobody# search resultsearch: 1result: 0 Success# numResponses: 2# numEntries: 1
    In a similar manner, you can even add a new attribute to an existing entry - here's how:
    
    [root@olympus] $ /usr/local/openldap/bin/ldapmodify -x -D
    "cn=root,dc=melonfire,dc=com" -W Enter LDAP Password: ****
    dn: mail=sarah@melonfire-mail.com, dc=melonfire, dc=com
    carLicense: MFC 437458
    modifying entry "mail=sarah@melonfire-mail.com, dc=melonfire, dc=com"
    
    And now, when you run the same search, you'll see that the entry contains your newly-added attribute:
    
    # extended LDIF
    #
    # LDAPv3
    # base <dc=melonfire,dc=com> with scope sub
    # filter: (cn=Sarah)
    # requesting: ALL
    #
    # sarah@melonfire-mail.com, melonfire.com
    dn: mail=sarah@melonfire-mail.com,dc=melonfire,dc=com
    objectClass: inetOrgPerson
    cn: Sarah
    mail: sarah@melonfire-mail.com
    telephoneNumber: 23 67 128 5639
    sn: Jones
    carLicense: MFC 437458
    # search result
    search: 1
    result: 0 Success
    # numResponses: 2
    # numEntries: 1
    
    Finally, you can easily remove existing entries from the database via the "ldapdelete" command - simply provide the DN of the entry to be deleted:
    
    [root@olympus] $ /usr/local/openldap/bin/ldapdelete -x -D
    "cn=root,dc=melonfire,dc=com" -W Enter LDAP Password: ****
    mail=rita@melonfire-mail.com, dc=melonfire, dc=com
    


     
     
    >>> More Administration Articles          >>> More By icarus, (c) Melonfire
     

       

    ADMINISTRATION ARTICLES

    - Capturing Packets with the Wireshark Network...
    - How to Use Wireshark Network Analyzer
    - Understanding TCP/IP Protocol Types
    - Network Booting via PXE: the Basics
    - Scalix: Linux Administrator`s Guide
    - Network Administration with FreeBSD 7
    - Components of an Information Architecture
    - The Anatomy of an Information Architecture
    - Configuring Load-Balanced Clusters
    - Load-Balanced Clusters
    - UNIX Time Format Demystified
    - Making Changes in the CVS
    - Building Your First CVS Repository
    - CVS Quickstart Guide
    - Authorizing Users in Samba



     



    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 11 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek