LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   LDAP- Intiital file import Failed (http://www.linuxquestions.org/questions/linux-server-73/ldap-intiital-file-import-failed-928738/)

unibox 02-10-2012 10:46 PM

LDAP- Intiital file import Failed
 
Hi everyone,

i am using centos 5.6 for openldap server, so i have created basic ldif file and imported using this command "ldapadd" everything is well.

my requirement:

i need to change or add some entries in existing ldif file and update again.
but i am getting error. also here with i have mention ldif file.

cat basic.ldif

dn: dc=example,dc=com
objectClass: dcObject
objectClass: organization
dc: example
o: Mydomain
description: my Corporation

# Hold users
dn: ou=People,dc=example,dc=com
objectClass: organizationalUnit
ou: People
#----------------------------------


2. now i need to add some line in basic.ldif file.

cat basic.ldif

dn: dc=example,dc=com
objectClass: dcObject
objectClass: organization
dc: example
o: Mydomain
description: my Corporation

# Hold users
dn: ou=People,dc=example,dc=com
objectClass: organizationalUnit
ou: People

# All info
dn: ou=Info,dc=example,dc=com
objectclass: organizationalUnit
ou: Info


now i am try to update new entry, using this below command. but i am getting "ldapmodify: No such object (32)" error.

#ldapmodify -f /etc/openldap/basic.ldif -x -D "cn=Manager,dc=example,dc=com" -W
Enter LDAP Password:*******

modifying entry "dc=example,dc=com"

modifying entry "ou=People,dc=example,dc=com"

modifying entry "ou=Info,dc=example,dc=com"
ldapmodify: No such object (32)
matched DN: dc=example,dc=com



if know ans.. please help me. thank's

druuna 02-11-2012 05:17 AM

Hi unibox,

Please don't delete the original question.

Looking at the [SOLVED] tag I can only assume you found the answer to your problem. Next time post this answer so that others might benefit from it (even if you think it was a "stupid/dumb" mistake).

Also: Of the zero-reply list.

unibox 02-13-2012 01:28 PM

Hi druuna

Actually I did not get the answer, that why I deleted my post. No problem I will re-update my question.

anomie 02-13-2012 04:56 PM

@unibox: Looks like you didn't add DN: ou=Info,dc=example,dc=com correctly. Right?

You can easily confirm with slapcat(8).

unibox 02-14-2012 12:33 AM

hi anomie thanks for reply

i already added DN entry's in basci.ldif file.

i.e

cat basic.ldif

dn: dc=example,dc=com
objectClass: dcObject
objectClass: organization
dc: example
o: Mydomain
description: my Corporation

# Hold users
dn: ou=People,dc=example,dc=com
objectClass: organizationalUnit
ou: People

# All info
dn: ou=Info,dc=example,dc=com
objectclass: organizationalUnit
ou: Info


while i am executing "ldapmodify" command, i am getting above mentioned same error.

bathory 02-14-2012 03:06 AM

Hi,

If you want to add
Quote:

# All info
dn: ou=Info,dc=example,dc=com
objectclass: organizationalUnit
ou: Info
you need to use ldapadd and not ldapmodify

Cheers

unibox 02-15-2012 01:11 AM

Hi bathory thanks for reply

As per your instruction, i tried "ldapadd" also, but i am getting "Already exists" error.

i.e

#ldapadd -v -D "cn=Manager,dc=example,dc=com" -x -W -f /etc/openldap/basic.ldif

ldap_initialize( <DEFAULT> )
Enter LDAP Password:*********
add objectClass:
dcObject
organization
add dc:
example
add o:
Mydomain
add description:
my Corporation
adding new entry "dc=example,dc=com"
modify complete
ldapadd: Already exists (68)


ldap search output:

# ldapsearch -x|less

# extended LDIF
#
# LDAPv3
# base <> with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#

# example.com
dn: dc=example,dc=com
objectClass: dcObject
objectClass: organization
dc: example
o: Mydomain
description: my Corporation

# People, int.leadgen.in
dn: ou=People,dc=example,dc=com
objectClass: organizationalUnit
ou: People

# search result
search: 2
result: 0 Success

bathory 02-15-2012 01:54 AM

Hi,

As I clearly mentioned in my previous post, you should add only
Code:

dn: ou=Info,dc=example,dc=com
objectclass: organizationalUnit
ou: Info

So put those 3 lines in a ldif file and use ldapadd to import in the ldap

Regards

unibox 02-15-2012 02:45 AM

Hi bathory guru thanks a lot.

now i have successfully added those entry's.

i have some doubts:

i want to keep all (OU) entry's in basic.ldif file.
as per your instruction, i have deleted remaining all entry's except "ou=info" entry, then only i can able to imported without any error.

if any possible to execute "ldapadd" command with all entry's(ou=info ou=People) in basic.ldif file.

bathory 02-15-2012 03:05 AM

Hi,
Quote:

if any possible to execute "ldapadd" command with all entry's(ou=info ou=People) in basic.ldif file.
The ldapadd is supposed to add entries that do not already exist in the directory, so it quits if it finds an already existing dn
You could use the "-c" switch in ldapadd with your basic.ldif, so it skips the existing entries and add only those that do not exist.

Regards

unibox 02-15-2012 03:21 AM

yes it's working..

Today i got the solution for this.


thank you so much.....etc....etc...

bathory 02-15-2012 03:37 AM

Quote:

Originally Posted by unibox (Post 4602706)
yes it's working..

Today i got the solution for this.


thank you so much.....etc....etc...

You're welcome. You may also mark the thread "Solved" from the thread tools on top of the page

Cheers


All times are GMT -5. The time now is 02:33 AM.