LDIF file error?? Invalid Format?

user1031752 picture user1031752 · May 28, 2012 · Viewed 11.1k times · Source

I am currently working with LDAP which is on a UNIX server. The main purpose for me right now is to modify two entries in the directory by Ldapmodify through command line. The command is as follows:

ldapmodify -a -D 'cn=ldap,dc=cs,dc=ttu,dc=edu' \
  -w *password* -H *server address* -f Documents/user.ldif

user.ldif file is as follows:

dn: cn=*username*,cn=Users,dc=ttu,dc=edu  
changetype: modify  
replace: displayName  
displayName:  abc  
-
replace: loginShell  
loginShell: /bin/tc   
-

I get the following error when i try to run it:

ldapmodify: invalid format (line 5) entry: "cn=*username*,cn=Users,dc=ttu,dc=edu"

I checked the "dn" and it is correct. Why am I getting this error then?

Answer

Bo Pan picture Bo Pan · Feb 25, 2014

I have a similar problem. In my case, my dn was correct, but it says "invalid format (line 16) ..." .

This is how I solved this: The error msg can be misleading, because the dn is indeed correct. But line number "(line 5)" is an accurate pointer to the problem. In your case, I think the dash '-' is causing the problem. Try to remove the dashes and it may work!