LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 09-04-2008, 10:08 AM   #1
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , Solaris 10, RHEL
Posts: 1,935
Blog Entries: 1

Rep: Reputation: 188Reputation: 188
Getting a "Can't contact LDAP server" when trying to add an ldif file


Hello,

I am running CentOS 5.2

When I try to add an ldif file I am getting this error...

Code:
root@ldap-server:~<2># /usr/bin/ldapadd -x -D 'uid=root,dc=ldap-gln,dc=mysite,dc=com' -W -f /tmp/mysite.ldif
Enter LDAP Password: 
ldap_bind: Can't contact LDAP server (-1)
So then I checked to see if openldap is running...

Code:
root@ldap-server:~<3># service ldap status
slapd (pid 7313) is running...
It's running...so I stopped openldap and restarted

Code:
root@ldap-server:~<4># service ldap restart
Stopping slapd:                                            [  OK  ]
Checking configuration files for slapd:  config file testing succeeded
                                                           [  OK  ]
Starting slapd:                                            [  OK  ]
But when I tried to run the ldapadd command I get the same error.

Here is the ldif file I'm using...

Code:
dn: dc=ldap-gln,dc=mysite,dc=com
objectclass: dcobject
objectClass: organization
o: Centos Directory Server
dc: mysite
Any suggestions/comments/help/concerns will be greatly appreceated! Just an FYI I'm using this howto...

http://www.opensourcehowto.org/how-t...ba-as-pdc.html

Thanks,

-C
 
Old 09-04-2008, 12:08 PM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,906

Rep: Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326
First make sure slapd is running and it's listening on the default port:
Code:
ps -ef|grep slapd
netstat -an|grep 389
If not, then check the system logs to see if you find the reason.
If everything is ok, then perhaps it's a SELinux problem, a firewall preventing connections, or something like that.
Try the more verbose command
Code:
/usr/bin/ldapadd -vx -D "uid=root,dc=ldap-gln,dc=mysite,dc=com" -W -f /tmp/mysite.ldif
Make sure that the binddn (uid=root,dc=ldap-gln,dc=mysite,dc=com" is the same as the rootdn defined in slapd.conf.
You can also stop slapd and use slapadd instead of ldapadd to add the ldif.

Regards
 
Old 09-04-2008, 12:18 PM   #3
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , Solaris 10, RHEL
Posts: 1,935
Blog Entries: 1

Original Poster
Rep: Reputation: 188Reputation: 188
Quote:
Originally Posted by bathory View Post
First make sure slapd is running and it's listening on the default port:
Code:
ps -ef|grep slapd
netstat -an|grep 389
If not, then check the system logs to see if you find the reason.
If everything is ok, then perhaps it's a SELinux problem, a firewall preventing connections, or something like that.
Try the more verbose command
Code:
/usr/bin/ldapadd -vx -D "uid=root,dc=ldap-gln,dc=mysite,dc=com" -W -f /tmp/mysite.ldif
Make sure that the binddn (uid=root,dc=ldap-gln,dc=mysite,dc=com" is the same as the rootdn defined in slapd.conf.
You can also stop slapd and use slapadd instead of ldapadd to add the ldif.

Regards
Thanks...here is the output of the commands...

Code:
root@ldap-server# ps -ef |grep slapd
ldap      9558     1  0 08:04 ?        00:00:00 /usr/sbin/slapd -h ldap:/// -u ldap
root      9850  9455  0 10:12 pts/0    00:00:00 grep slapd

Code:
root@ldap-server# netstat -an|grep 389
tcp        0      0 0.0.0.0:389                 0.0.0.0:*                   LISTEN      
tcp        0      0 :::389                      :::*                        LISTEN
Here is my slapd.conf file...

Code:
include         /etc/openldap/schema/core.schema
include         /etc/openldap/schema/cosine.schema
include         /etc/openldap/schema/inetorgperson.schema
include         /etc/openldap/schema/nis.schema
include         /etc/openldap/schema/samba.schema

allow bind_v2


pidfile         /var/run/openldap/slapd.pid
argsfile        /var/run/openldap/slapd.args






database        bdb
suffix  "dc=ldap-gln,dc=mysite,dc=com"
rootdn  "uid=root,dc=ldap-gln,dc=mysite,dc=com"
rootpw  {SSHA}vEmhoewI7wNUjjzpeg1Ys51cWfIqY+rO

directory       /var/lib/ldap

index objectClass                       eq,pres
index ou,cn,mail,surname,givenname      eq,pres,sub
index uidNumber,gidNumber,loginShell    eq,pres
index uid,memberUid                     eq,pres,sub
index nisMapName,nisMapEntry            eq,pres,sub
Here is my ldap.conf file
Code:
URI ldap://127.0.0.1/
HOST ldap-gln.mysite.com
BASE dc=ldap-gln,dc=mysite,dc=com
TLS_CACERTDIR /etc/openldap/cacerts
I disabled SELinux and the Firewall...The URI entry I added and I tired the same command again.. now I am getting this error...

Code:
[root@aardvark:~<24>]# /usr/bin/ldapadd -x -D 'uid=root,dc=ldap-gln,dc=mysite,dc=com' -W -f /tmp/4over.ldif 
Enter LDAP Password: 
adding new entry "dc=ldap-gln,dc=mysite,dc=com"
ldap_add: Naming violation (64)
        additional info: value of naming attribute 'dc' is not present in entry

Last edited by custangro; 09-04-2008 at 12:35 PM.
 
Old 09-04-2008, 12:57 PM   #4
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,906

Rep: Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326Reputation: 1326
Quote:
Here is the ldif file I'm using...

Code:

dn: dc=ldap-gln,dc=mysite,dc=com
objectclass: dcobject
objectClass: organization
o: Centos Directory Server
dc: mysite
Change the last line to:
Code:
dc: ldap-gln
Also it's better to use double quotes for binddn.
 
Old 09-04-2008, 01:00 PM   #5
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , Solaris 10, RHEL
Posts: 1,935
Blog Entries: 1

Original Poster
Rep: Reputation: 188Reputation: 188
Solved

Quote:
Originally Posted by bathory View Post
Change the last line to:
Code:
dc: ldap-gln
Also it's better to use double quotes for binddn.
Thank you sir!

That did it! It works now! :-)

-C
 
  


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
how can I "cat" or "grep" a file to ignore lines starting with "#" ??? callagga Linux - Newbie 7 08-16-2013 06:58 AM
Problem ldif file for ldap finsh Linux - Server 5 01-15-2008 11:16 AM
Error launching gnome apps as root: " Failed to contact configuration server" Kropotkin Fedora 1 12-16-2005 11:11 AM
New to Open LDAP. Trying to import an LDIF file. davealex Linux - Networking 1 10-16-2003 03:19 PM
CUPS: "unable to contact server!" Phil Healey Linux - Software 2 09-05-2003 03:51 AM


All times are GMT -5. The time now is 02:57 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