How do I modify/delete a single attribute from the directory when I have multiple attributes of the same name. For example, given the following ldif: dn: cn=config,o=dhcp cn: config objectClass: top objectClass: dhcpService objectClass: dhcpOptions dhcpPrimaryDN: cn=server1,o=dhcp dhcpStatements: default-lease-time 600 dhcpStatements: max-lease-time 1200 dhcpStatements: ddns-update-style none dhcpStatements: boot-unknown-clients on dhcpStatements: log-facility local7
How would I modify just one of the dhcpStatements: attributes, for example, change 'dhcpStatements: log-facility local7' to 'dhcpStatements: log-facility local3'?
I've tried an ldif with: dn: cn=config,o=dhcp changetype: modify replace: dhcpStatements log-facility local7 dhcpStatements: log-facility local3 But that just gave me an error: ldapmodify: Undefined attribute type (17) additional info: dhcpStatements log-facility local7: AttributeDescription contains inappropriate characters.
I've also tried: dn: cn=config,o=dhcp changetype: modify replace: dhcpStatements dhcpStatements: log-facility local3 But that just gave me an error: replace modify: dhcpStatements replace dhcpStatements: log-facility local3 modifying entry "cn=config,o=dhcp" modify complete ldapmodify: Undefined attribute type (17) additional info: modify: attribute type undefined
I can use 'delete: dhcpStatements' but that deletes all of the dhcpStatements and then I have to add all of them back with the modification to the one that's needed.
So, what ldapmodify/ldif syntax is needed to specify which of multiple attributes should be modified?
You need to use LDIF as specified in RFC 2849; note that there is a specific example that shows what you're trying to accomplish:
# Modify an entry: add an additional value to the postaladdress # attribute, completely delete the description attribute, replace # the telephonenumber attribute with two values, and delete a specific # value from the facsimiletelephonenumber attribute dn: cn=Paula Jensen, ou=Product Development, dc=airius, dc=com changetype: modify add: postaladdress postaladdress: 123 Anystreet $ Sunnyvale, CA $ 94086 - delete: description - replace: telephonenumber telephonenumber: +1 408 555 1234 telephonenumber: +1 408 555 5678 - delete: facsimiletelephonenumber facsimiletelephonenumber: +1 408 555 9876 -
In detail, look at the 'facsimiletelephonenumber' portion of the operation.
p.