Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 04-29-2009, 12:09 AM   #1
Registered: Sep 2008
Location: Perth, Australia
Distribution: RedHat, Solaris
Posts: 38

Rep: Reputation: 15
Unhappy ldap_add:Invalid Syntax Error (23)


I am sorry if this is in the wrong forum, wasnt sure where to put it. Can someone PLEASE help!? I have searched google and had no luck.

I have RHEL 4.5, I am running openLDAP.
I have managed to get the server up and running, slapd is started. I have created my groups and I have run into problems trying to add my first user..
People ldif entry:
dn: ou=people,dc=example,dc=aus,dc=edu,dc=net,dc=com
objectClass: top
objectClass: organizationalUnit
ou: people

dn: ou=group,dc=example,dc=aus,dc=edu,dc=net,dc=com
objectClass: top
objectClass: organizationalUnit
ou: group
Group ldif entry:
dn: cn=dcs,ou=group,dc=example,dc=aus,dc=edu,dc=net,dc=com
objectClass: posixGroup
objectClass: top
cn: dcs
gidNumber: 9000
memberuid: testusr
User ldif entry:
dn: cn=testusr,ou=people,dc=example,dc=aus,dc=edu,dc=net,dc=com
objectClass: top
objectClass: posixAccount
objectClass: account
objectClass: shadowAccount
cn: testusr
sn: usr
uid: testusr
uidNumber: 600
gidNumber: 9000
homeDirectory: /userdirs/testusr
userPassword: change123
loginShell: /bin/csh
shadowMax: 60
Then when i type:

ldapadd -x -D "cn=Administrator,dc=example,dc=aus,dc=edu,dc=net,dc=com" -W -f testusr.ldif
Enter LDAP Password:
adding new entry "cn=testusr,ou=people,dc=example,dc=aus,dc=edu,dc=net,dc=com"
ldap_add: Invalid syntax (23)
        additional info: gidNumber: value #0 invalid per syntax
I have no idea what I am doing wrong. When I try and add the user without adding into a group i get:
ldap_add: Invalid syntax (21)
        additional info: uidNumber: value #0 invalid per syntax
Any help would be greatly appreciated!! I am borderline newbie on this so apologies if this is a simple error I am making?!?
Old 04-29-2009, 02:23 AM   #2
LQ Guru
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

I honestly don't see anything wrong with what you've shown...
... but I'm virtually certain it's some simple spelling or punctuation error somewhere. Here's an example:
dapadd -x -D "cn=Manager,dc=mdah,dc=state,dc=ms,dc=us" -W -f main.ldif
Enter LDAP Password:
adding new entry "dc=mdah,dc=state,dc=ms,dc=us"

adding new entry "cn=Manager,dc=mdah,dc=state,dc=ms,dc=us"
ldapadd: Invalid syntax (21)
additional info: objectclass: value #0 invalid per syntax
dn: cn=Manager,dc=mdah,dc=state,dc=ms,dc=us
objectclass: organzationalRole
cn: Manager
<= "organizationalRole" was mis-spelled
'Hope that helps .. PSM
Old 04-30-2009, 12:30 AM   #3
Registered: Sep 2008
Location: Perth, Australia
Distribution: RedHat, Solaris
Posts: 38

Original Poster
Rep: Reputation: 15
Thumbs up

Hi Paulsm4,

thanks for your suggestion. I have fixed the problem, however unfortunately I cannot be certain as to what the solution was. Sorry all those people who read this for help!!

However, here are my suggestions or rather the things I did change just before it miraculously worked!!

I modified the group entry to include attribute memberuid: as below.

dn: cn=dcs,ou=group,dc=apgsis88,dc=perth,dc=oilfield,dc=slb,dc=com
objectClass: posixGroup
objectClass: top
cn: dcs
gidNumber: 9000
memberuid: testusr
I also restarted slapd server.

[root@testsrv88 ldap]# service ldap restart
I'm sure it was something simple that I did above but unfortunately dont know which of these things was the key!

Thanks for your suggestions paulsm4.
Old 09-07-2011, 10:33 AM   #4
LQ Newbie
Registered: Sep 2011
Posts: 1

Rep: Reputation: Disabled
Invisible typo

I had exactly the same error, it turned out in my ldif file I had:

loginShell: /bin/bash
uidNumber: 9015 
gidNumber: 20
for clarity:
"uidNumber: 9015 "
and not as it should have been:
"uidNumber: 9015"

There was a space at the end of the numeric uidNumber value. I'd copied the value out of another file and didn't see the space, but it was enough to waste an hour of my life.


invalid, syntax

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
LDAP Problem Invalid DN Syntax (34) steve007 Linux - Newbie 3 08-24-2009 08:53 AM
Virtual Machine Manager - Invalid Syntax rajeshux Red Hat 5 11-20-2008 11:35 AM
[Python] Invalid Syntax - If statement LinuxCrayon Programming 4 12-07-2007 10:11 AM
LDAP Problem Invalid DN syntax (34) steve007 Linux - Newbie 3 10-18-2005 06:03 AM
URGENT: ldap_add(): Add: Object class violation error 65 sierraaltae Linux - Security 1 08-05-2005 11:41 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:47 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration