LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 02-10-2012, 09:46 PM   #1
unibox
Member
 
Registered: Dec 2011
Location: India
Distribution: Centos,redhat,zentyal
Posts: 43
Blog Entries: 1

Rep: Reputation: Disabled
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

Last edited by unibox; 02-13-2012 at 01:00 PM.
 
Old 02-11-2012, 04:17 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371
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.

Last edited by druuna; 02-11-2012 at 01:55 PM. Reason: spelling
 
Old 02-13-2012, 12:28 PM   #3
unibox
Member
 
Registered: Dec 2011
Location: India
Distribution: Centos,redhat,zentyal
Posts: 43
Blog Entries: 1

Original Poster
Rep: Reputation: Disabled
Hi druuna

Actually I did not get the answer, that why I deleted my post. No problem I will re-update my question.
 
Old 02-13-2012, 03:56 PM   #4
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora, Lubuntu, FreeBSD
Posts: 3,930
Blog Entries: 5

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

You can easily confirm with slapcat(8).
 
Old 02-13-2012, 11:33 PM   #5
unibox
Member
 
Registered: Dec 2011
Location: India
Distribution: Centos,redhat,zentyal
Posts: 43
Blog Entries: 1

Original Poster
Rep: Reputation: Disabled
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.

Last edited by unibox; 02-14-2012 at 01:36 AM.
 
Old 02-14-2012, 02:06 AM   #6
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,881

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
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
 
Old 02-15-2012, 12:11 AM   #7
unibox
Member
 
Registered: Dec 2011
Location: India
Distribution: Centos,redhat,zentyal
Posts: 43
Blog Entries: 1

Original Poster
Rep: Reputation: Disabled
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
 
Old 02-15-2012, 12:54 AM   #8
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,881

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
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
 
1 members found this post helpful.
Old 02-15-2012, 01:45 AM   #9
unibox
Member
 
Registered: Dec 2011
Location: India
Distribution: Centos,redhat,zentyal
Posts: 43
Blog Entries: 1

Original Poster
Rep: Reputation: Disabled
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.

Last edited by unibox; 02-15-2012 at 01:56 AM.
 
Old 02-15-2012, 02:05 AM   #10
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,881

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
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
 
1 members found this post helpful.
Old 02-15-2012, 02:21 AM   #11
unibox
Member
 
Registered: Dec 2011
Location: India
Distribution: Centos,redhat,zentyal
Posts: 43
Blog Entries: 1

Original Poster
Rep: Reputation: Disabled
yes it's working..

Today i got the solution for this.


thank you so much.....etc....etc...
 
Old 02-15-2012, 02:37 AM   #12
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,881

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
Quote:
Originally Posted by unibox View Post
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
 
  


Reply


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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can samba passwd file import into LDAP ? niraj.kumar Linux - Server 4 12-02-2008 08:12 PM
How can i import my smbpasswd file into LDAP ?? niraj.kumar Linux - Newbie 1 11-29-2008 12:14 PM
How can i import my smbpasswd file into LDAP ?? niraj.kumar Linux - Server 0 11-29-2008 10:28 AM
New to Open LDAP. Trying to import an LDIF file. davealex Linux - Networking 1 10-16-2003 03:19 PM


All times are GMT -5. The time now is 03:45 PM.

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