Linux – ldapmodify error – Server is unwilling to perform (53) additional info: no global superior knowledge

linuxopenldap

Ok guys, I've been beating my head against the wall over this one all day, and I'm getting nowhere. I'm trying to run ldapmodify against OpenLDAP in a script to update a couple of attributes for a series of hosts. No matter what I do, I get "Server is unwilling to perform… no global superior knowledge."

Here's my code, with dummy values inserted. Can anybody see what I'm doing wrong?

for sys in <system names>; do
  ldapmodify -x -c -h localhost -D uid=name,dc=example,dc=com -w ${password} <<EOF
    dn: hostname=${sys},ou=computers,location=code,dc=example,dc=com
    changetype: modify
    replace: ip
    ip: new.host.ip.address
    -
    replace: printer
    printer: new.printer.ip.address
EOF
done

The DN matches the DN provided by ldapsearch perfectly, so I don't see how it could be the problem. Like I said though, I just don't see the problem, so any suggestions are welcome.

Also, the suffix in slapd.conf is dc=example,dc=com.

Best Answer

It's amazing how the little things can bite you so hard. Since this was in a script, I indented the command section to keep with coding conventions. Apparently, ldapmodify interpreted the white space as part of the commands/data and got confused. I reformatted it to look like this, and now it works:

for sys in <system names>; do
  ldapmodify -x -c -h localhost -D uid=name,dc=example,dc=com -w ${password} <<EOF
dn: hostname=${sys},ou=computers,location=code,dc=example,dc=com
changetype: modify
replace: ip
ip: new.host.ip.address
-
replace: printer
printer: new.printer.ip.address
EOF
done