Administration
  Home arrow Administration arrow Page 7 - Understanding LDAP (part 2)
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
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? 
ADMINISTRATION

Understanding LDAP (part 2)
By: icarus, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 9
    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:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb 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

    Dell PowerEdge Servers

    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

    - 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
    - Handling User Accounts in Samba
    - Authentication in Samba
    - Accounts, Authentication, and Authorization
    - Advanced Concepts on Dealing with Files and ...
    - Dealing with Files and Filesystems
    - More Hacks for the User Environment in BSD
    - Personalizing the User Environment in BSD
    - Customizing the User Environment in BSD




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway