Overview[1]#
Modrdn is a LDIF directive (or moddn) is used to change the RDN of the LDAP Entry (rename or copy the entry) defined by the preceding dn: directive.Modrdn is the LDIF changeType directive for ModifyDNRequest.
Modrdn MUST be followed by a NewRDN directive and may be followed by a DeleteOldRDN and a NewSuperior directive.
Typically depending on the LDAP Server Implementation you CANNOT rename the LDAP Entry if the entry has one or more child entries.
LDIF Examples for Modrdn:#
dn: cn=Robert Ssmith,ou=people,dc=example,dc=com # following sequence renames the above DN to # cn=Robert Smith,ou=people.dc=example,dc=com # and deletes the entry # cn=Robert Ssmith,ou=people,dc=example,dc=com changetype: modrdn newrdn: cn=Robert Smith deleteoldrdn: 1
Here are the keywords and descriptions:
Modrdn Modrdn - Renaming an Entry#
The following example shows how to rename an entry and retain the old value:version: 1 dn: cn=johndoe, ou=provo, ou=users, o=novell changetype: moddn newrdn: cn= jimmydoe deleteoldrdn: 0
Modrdn Modrdn - Moving an Entry#
The following example shows how to move an entry from the provo container to the toronto container:version: 1 dn: cn=johndoe, ou=provo, ou=users, o=novell changetype: moddn newrdn: cn=johndoe deleteoldrdn: 1 newsuperior: ou=toronto, ou=users, o=novell
Modrdn Modrdn - Renaming and Moving an Entry#
The following example shows how to rename and move an entry in the same operation:version: 1 dn: cn=johndoe, ou=provo, ou=users, o=novell changetype: moddn newrdn: cn=jimmydoe deleteoldrdn: 0 newsuperior: ou=toronto, ou=users, o=novell
Example to move the entry from people to expeople#
# moves the entry from people to expeople dn: cn=Robert Smith,ou=people,dc=example,dc=com changetype: modrdn # NOTE: rdn unchanged newrdn: cn=Robert Smith # deletes old entry deleteoldrdn: 1 # adds to expeople hierarchy newsuperior: ou=expeople,dc=example,dc=com
Example to copy of the entry in expeople#
# makes a copy of the entry in expeople dn: cn=Robert Smith,ou=people,dc=example,dc=com changetype: modrdn # NOTE: rdn unchanged newrdn: cn=Robert Smith # keeps current entry deleteoldrdn: 0 # adds to expeople hierarchy newsuperior: ou=expeople,dc=example,dc=comcom]
More Information#
There might be more information for this subject on one of the following:- Differences between LDAP 2 and 3 Protocols
- LDAP Object Identifier Descriptors
- Moddn
- ModifyDNRequest
- Modrdn
- NewRDN
- NewSuperior
- RID Master FSMO Role
- [#1] - LDAP LDIF and DSML
- based on information obtained 2016-07-03