How do I get `ldapmodify` to change an indexed attribute in OpenLDAP?

960 views Asked by At

I am trying to set up an OpenLDAP directory using the cn=config (or olc) method. I have got an entry in my directory that looks something like the following:

dn: cn=entry,...
olcAttr: {0}first value...
olcAttr: {1}second value...
olcAttr: {2}third value...

I would like to use ldapmodify to change the attribute {0}first value... to something else, but keeping the same index ({0} - is "index" the right term?).

I tried using the following

dn: cn=entry,...
changetype: modify
replace: olcAttr{0}
olcAttr: {0}new value...

and sundry variations on this theme, but nothing has worked. I have googled (web, duckducked actually) but I don't even know what I am looking for is called, which doesn't make things easier. Can anyone give me some guidance please?

Steve

1

There are 1 answers

0
Stephen Winnall On BEST ANSWER

The simple answer to this question is that you replace ALL of the attributes, thus:

dn: cn=entry,...
changetype: modify
replace: olcAttr
olcAttr: {0}NEW value...
olcAttr: {1}second value...
olcAttr: {2}third value...

There's got to be a better way, surely?