go to  ForumEasy.com   
LdapPro  
 
 
   Home  |  MyForum  |  FAQ  |  Archive    You are not logged in. [Login] or [Register]  
Forum Home » LDAP Model, Schema & LDIF » LDAP Command-Line Tool - ldapmodify examples with sample ldif files
Email To Friend  |   Set Alert To This Topic Rewarding Points Availabe: 0 (What's this) New Topic  |   Post Reply
Author Topic: LDAP Command-Line Tool - ldapmodify examples with sample ldif files
eLDAP
member
offline   
 
posts: 107
joined: 08/02/2006
from: Austin, TX
  posted on: 07/08/2011 09:22:50 PM    Edit  |   Quote  |   Report 
LDAP Command-Line Tool - ldapmodify examples with sample ldif files
Use the command-line tool ldapmodify to modify existing entries. ldapmodify opens a connection to the directory and authenticates the user. Then it opens the LDIF file supplied as an argument and modifies the LDAP entries specified by the file.

ldapmodify uses a modified form of an LDIF file. Within the file itself, you use the attribute changetype to specify the type of change.

Syntax
ldapmodify [options] [-f LDIF-filename]

Example
ldapmodify -h localhost -p 389 -D "uid=testuser" -w password -f changes.ldif


 Profile | Reply Points Earned: 0
eLDAP
member
offline   
 
posts: 107
joined: 08/02/2006
from: Austin, TX
  posted on: 07/08/2011 09:25:21 PM    Edit  |   Quote  |   Report 
Sample ldapmodify LDIF file -- Adding value(s)

dn: uid=user.01,ou=people,dc=example,dc=com
changetype: modify
add: title
title: HR manager
title: Director of operation
title: VP sales


The changetype is classified as modify-add and loading this LDIF file is going to add the values listed to the given attribute title, creating the attribute if necessary.

 Profile | Reply Points Earned: 0
eLDAP
member
offline   
 
posts: 107
joined: 08/02/2006
from: Austin, TX
  posted on: 07/08/2011 09:26:17 PM    Edit  |   Quote  |   Report 
Sample ldapmodify LDIF file -- Deleting value(s)

dn: uid=user.01,ou=people,dc=example,dc=com
changetype: modify
delete: title
title: HR manager
title: Director of operation


The changetype is classified as modify-delete and loading this LDIF file is going to delete the values listed from the given attribute title, removing the entire attribute if all current values of the attribute are listed for deletion.


If no values are listed, as follows:

dn: uid=user.01,ou=people,dc=example,dc=com
changetype: modify
delete: title


the entire attribute is going to be removed.


 Profile | Reply Points Earned: 0
eLDAP
member
offline   
 
posts: 107
joined: 08/02/2006
from: Austin, TX
  posted on: 07/08/2011 09:27:18 PM    Edit  |   Quote  |   Report 
Sample ldapmodify LDIF file -- Replacing value(s)

dn: uid=user.01,ou=people,dc=example,dc=com
changetype: modify
replace: title
title: Sales manager
title: VP operation


The changetype is classified as modify-replace and loading this LDIF file is going to replace all exsiting values with the new values listed, creating the attribute if necessary.

If no values are listed, as follows:

dn: uid=user.01,ou=people,dc=example,dc=com
changetype: modify
replace: title


the entire attribute is going to be removed.

 Profile | Reply Points Earned: 0
eLDAP
member
offline   
 
posts: 107
joined: 08/02/2006
from: Austin, TX
  posted on: 07/08/2011 09:28:30 PM    Edit  |   Quote  |   Report 
Sample ldapmodify LDIF file -- Renaming an entry

dn: uid=user.01,ou=people,dc=example,dc=com
changetype: modrdn
newrdn: uid=user001
deleteoldrdn: 0


The changetype is classified as modRDN and loading this LDIF file is going to rename the current dn of the entry from
"uid=user.01,ou=people,dc=example,dc=com"

to

"uid=user001,ou=people,dc=example,dc=com"

without (0) removing the old rdn uid=user.01 from the entry.

 Profile | Reply Points Earned: 0
eLDAP
member
offline   
 
posts: 107
joined: 08/02/2006
from: Austin, TX
  posted on: 07/08/2011 09:29:37 PM    Edit  |   Quote  |   Report 
Sample ldapmodify LDIF file -- Putting all together (Changes within an entry)

dn: uid=user.01,ou=people,dc=example,dc=com
changetype: modify
add: title
title: HR manager
title: Director of operation
-
delete: mail
mail: user.01@example.com
-
delete: description
-
replace: telephonenumber
telephonenumber: 1-123-555-1234
telephonenumber: 1-123-555-6789
-
delete: description


 Profile | Reply Points Earned: 0
eLDAP
member
offline   
 
posts: 107
joined: 08/02/2006
from: Austin, TX
  posted on: 07/08/2011 09:30:16 PM    Edit  |   Quote  |   Report 
Sample ldapmodify LDIF file -- Putting all together (Changes across entry)

dn: uid=user.01,ou=people,dc=example,dc=com
changetype: modify
add: title
title: HR manager
title: Director of operation

dn: uid=user.01,ou=people,dc=example,dc=com
changetype: modify
delete: mail
mail: user.01@example.com

dn: uid=user.01,ou=people,dc=example,dc=com
changetype: modify
delete: description

dn: uid=user.01,ou=people,dc=example,dc=com
changetype: modify
replace: telephonenumber
telephonenumber: 1-123-555-1234
telephonenumber: 1-123-555-6789

dn: uid=user.01,ou=people,dc=example,dc=com
changetype: modify
delete: description

dn: uid=user.01,ou=people,dc=example,dc=com
changetype: modify
delete: description

dn: uid=user.01,ou=people,dc=example,dc=com
changetype: modrdn
newrdn: uid=user001
deleteoldrdn: 0


 Profile | Reply Points Earned: 0

 
Powered by ForumEasy © 2003-2005, All Rights Reserved. | Privacy Policy | Terms of Use
 
Get your own forum today. It's easy and free.