# LDAP Mystery - cannot even test base DN

**URL:** <https://help.nextcloud.com/t/ldap-mystery-cannot-even-test-base-dn/9372>\
**Category:** ℹ️ Support\
**Tags:** centos, selinux, ldap\
**Created:** [February 25, 2017, 1:04am UTC](https://help.nextcloud.com/t/ldap-mystery-cannot-even-test-base-dn/9372 "2017-02-25T01:04:49Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![cshenderson](https://help.nextcloud.com/letter_avatar/cshenderson/32/5_5575768a8748004e209b776fc1b2916d.png) [@cshenderson](https://help.nextcloud.com/u/cshenderson)\
**Post date:** [February 25, 2017, 1:04am UTC](https://help.nextcloud.com/t/ldap-mystery-cannot-even-test-base-dn/9372/1 "2017-02-25T01:04:50Z")

</div>

–Cant even get past the initial Base DN setup for LDAP.  
–Detect port fails to detect, base dn fails to detect.  
–After I fill in the IP address, port, user and Base DN. The Test DN fails.

LDAP server being connected to (Windows 2008R2)  
Nextcloud version _(11.0.1)_:  
Operating system and version \__(CentOS 7_)  
Apache or nginx version \_(_nginx_)  
PHP version \_(_7.0.15_) Installed from Webtatic repo  
MySQL _5.5.52_  
Is this the first time you’ve seen this error?: NO

**NOTE1** : Owncloud 9 has same error  
**NOTE2** : I installed ldapsearch on the same machine (using same ports) and have no problem listing entries from the same windows server.  
**NOTE3** : working ldapsearch string: ldapsearch -x -h 10.0.49.27 -D “owncloud.connect” -W -x “(&(objectclass=inetOrgPerson)(uid=nxtclduser))” -b “dc=cognops,dc=local”  
**NOTE4** : I am thinking this may be a php7 issue.  
**NOTE5** : If I fill in all the rest of the informatio for LDAP user strings, etc. Nextcloud can still not connect to LDAP, nor have a successful test of Base DN.

Base LDAP Setup:  
Server: 10.0.49.27  
Port: 389  
User: CN=owncloud.connect,OU=Automation,DC=cognops,DC=local  
Password: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
Dase DN: DC=cognops,DC=local

The output of your Nextcloud log in **Admin \> Logging** :  
Configuration Error (prefix ): login filter does not contain %uid place holder. 2017-02-24T18:43:31-0600  
Warning user\_ldap Configuration Error (prefix ): No LDAP Login Filter given! 2017-02-24T18:43:31-0600  
Warning user\_ldap Configuration Error (prefix ): No LDAP Port given! 2017-02-24T18:43:31-0600  
Warning user\_ldap Configuration Error (prefix ): login filter does not contain %uid place holder. 2017-02-24T18:43:31-0600  
Warning user\_ldap Configuration Error (prefix ): No LDAP Login Filter given! 2017-02-24T18:43:31-0600  
Warning user\_ldap Configuration Error (prefix ): No LDAP Port given! 2017-02-24T18:43:31-0600  
Warning user\_ldap Configuration Error (prefix ): login filter does not contain %uid place holder.

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*The output of your config.php file in `/path/to/nextcloud` (make sure you remove any identifiable information!):

\<?php $CONFIG = array ( 'instanceid' =\> '\*\*\*\*\*\*\*\*\*\*\*\*', 'passwordsalt' =\> '\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*', 'secret' =\> '\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*', 'trusted\_domains' =\> array ( 0 =\> '10.0.49.40', ), 'datadirectory' =\> '/usr/share/nginx/html/nextcloud/data', 'overwrite.cli.url' =\> 'https://10.0.49.40', 'dbtype' =\> 'mysql', 'version' =\> '11.0.1.2', 'dbname' =\> 'nextcloud\_db', 'dbhost' =\> 'localhost', 'dbport' =\> '', 'dbtableprefix' =\> 'oc\_', 'dbuser' =\> '\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*', 'dbpassword' =\> '\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*', 'logtimezone' =\> 'UTC', 'installed' =\> true, 'ldapIgnoreNamingRules' =\> false, 'ldapProviderFactory' =\> '\\OCA\\User\_LDAP\\LDAPProviderFactory', ); \*\*\*\*\*\*\*\*\*\*\*\*\*\*The output of your Apache/nginx/system log in `/var/log/ ____ `: 2017/02/24 19:17:18 [error] 30301#0: \*580 access forbidden by rule, client: 10.0.49.104, server: cloud.nextcloud.co, request: "GET /data/.ocdata?t=1487981838289 HTTP/1.1"$ 2017/02/24 19:41:03 [error] 30307#0: \*841 access forbidden by rule, client: 10.0.49.104, server: cloud.nextcloud.co, request: "GET /data/.ocdata?t=1487983263617 HTTP/1.1"$ 2017/02/24 19:41:06 [error] 30306#0: \*849 access forbidden by rule, client: 10.0.49.104, server: cloud.nextcloud.co, request: "GET /data/.ocdata?t=1487983266030 HTTP/1.1"$ 2017/02/24 19:43:30 [error] 30307#0: \*841 access forbidden by rule, client: 10.0.49.104, server: cloud.nextcloud.co, request: "GET /data/.ocdata?t=1487983410512 HTTP/1.1"$ ---

---

<div class="post-metadata">

**Author:** ![cshenderson](https://help.nextcloud.com/letter_avatar/cshenderson/32/5_5575768a8748004e209b776fc1b2916d.png) [@cshenderson](https://help.nextcloud.com/u/cshenderson)\
**Post date:** [February 27, 2017, 4:38pm UTC](https://help.nextcloud.com/t/ldap-mystery-cannot-even-test-base-dn/9372/2 "2017-02-27T16:38:31Z")

</div>

Anybody have any ideas?

---

<div class="post-metadata">

**Author:** ![sackla](https://help.nextcloud.com/user_avatar/help.nextcloud.com/sackla/32/2358_2.png) [@sackla](https://help.nextcloud.com/u/sackla)\
**Post date:** [March 3, 2017, 8:12am UTC](https://help.nextcloud.com/t/ldap-mystery-cannot-even-test-base-dn/9372/3 "2017-03-03T08:12:09Z")

</div>

the errors in your log point to a configuration error. did you check the “Login Attributes” section?

---

<div class="post-metadata">

**Author:** ![kibade](https://help.nextcloud.com/letter_avatar/kibade/32/5_5575768a8748004e209b776fc1b2916d.png) [@kibade](https://help.nextcloud.com/u/kibade)\
**Post date:** [March 20, 2017, 6:52pm UTC](https://help.nextcloud.com/t/ldap-mystery-cannot-even-test-base-dn/9372/4 "2017-03-20T18:52:31Z")

</div>

I get the same errors, with the exact same info I can use in ldapadmin browser to connect and browse to my AD server?

My errors  
Warning user\_ldap Configuration Error (prefix ): login filter does not contain %uid place holder.  
Warning user\_ldap Configuration Error (prefix ): No LDAP Login Filter given!

Below are my nextcloud settings, note this is a test server:

ldaps://192.168.0.7 (I’ve used my FQDN testad, or testad.xxx.xx.xx I’ve also user ldap://xxx  
I’ve used port 389 or 636  
uid=administrator,cn=users,dc=testad,dc=sd57,dc=bc,dc=ca  
Password xxxxxxxxxx  
DN dc=testad,dc=sd57,dc=bc,dc=ca

My ldapadmin browser that work settings  
Host testad  
port 636  
Base: DC=testad,DC=sd57,DC=bc,DC=ca  
Simple Authentication, SSL  
Username cn=administrator,cn=users,dc=testad,dc,xxx,dc=xx,dc=xx  
Password xxxxxx  
On ldapadmin I do get a warning that I can verify the cert, but I just click OK and it works.  
Any thoughts?

---

<div class="post-metadata">

**Author:** ![sackla](https://help.nextcloud.com/user_avatar/help.nextcloud.com/sackla/32/2358_2.png) [@sackla](https://help.nextcloud.com/u/sackla)\
**Post date:** [March 29, 2017, 9:06am UTC](https://help.nextcloud.com/t/ldap-mystery-cannot-even-test-base-dn/9372/5 "2017-03-29T09:06:40Z")

</div>

hi kibade.

sorry for the late answer. did you solve your problem?  
if not: i would have a look at your used DNs.

- **uid** =administrator,cn=users,dc=testad,dc=sd57,dc=bc,dc=ca
- **cn** =administrator,cn=users,dc=testad,dc,xxx,dc=xx,dc=xx

are two entirely different entries!

---

<div class="post-metadata">

**Author:** ![cshenderson](https://help.nextcloud.com/letter_avatar/cshenderson/32/5_5575768a8748004e209b776fc1b2916d.png) [@cshenderson](https://help.nextcloud.com/u/cshenderson)\
**Post date:** [March 29, 2017, 4:56pm UTC](https://help.nextcloud.com/t/ldap-mystery-cannot-even-test-base-dn/9372/6 "2017-03-29T16:56:18Z")

</div>

That was me trying different accounts in case it was some sort of LDAP issue.

I finally solved this by installing Nextcloud on Ubuntu instead of CentOS. Same exact install, same versions of PHP and NGINX.

And no, it wasn’t SELinux. (I had disabled it at some point during testing) I still don’t really know why it didn’t work.

---

<div class="post-metadata">

**Author:** ![Andres\_Sierra](https://help.nextcloud.com/user_avatar/help.nextcloud.com/andres_sierra/32/7667_2.png) [@Andres\_Sierra](https://help.nextcloud.com/u/Andres_Sierra)\
**Post date:** [February 9, 2018, 8:55am UTC](https://help.nextcloud.com/t/ldap-mystery-cannot-even-test-base-dn/9372/7 "2018-02-09T08:55:37Z")

</div>

Hi all, found solution here

[https://www.linuxquestions.org/questions/linux-server-73/ldap-authentication-error-[can't-contact-ldap-server]-from-apache-httpd-920907/](https://www.linuxquestions.org/questions/linux-server-73/ldap-authentication-error-%5Bcan%27t-contact-ldap-server%5D-from-apache-httpd-920907/)

If your enviroment is Centos with selinux enabled, you have to let apache connect to ldap

Check with

#getsebool -a|grep ldap

enable with

#setsebool httpd\_can\_connect\_ldap 1

and restart apache.

---

<div class="post-metadata">

**Author:** ![Anderson\_Souza](https://help.nextcloud.com/user_avatar/help.nextcloud.com/anderson_souza/32/24060_2.png) [@Anderson\_Souza](https://help.nextcloud.com/u/Anderson_Souza)\
**Post date:** [April 22, 2020, 1:45pm UTC](https://help.nextcloud.com/t/ldap-mystery-cannot-even-test-base-dn/9372/9 "2020-04-22T13:45:42Z")

</div>

Did the work here  
Nextcloud on Redhat.

Thank you

---

<div class="post-metadata">

**Author:** ![jbilbrey](https://help.nextcloud.com/letter_avatar/jbilbrey/32/5_5575768a8748004e209b776fc1b2916d.png) [@jbilbrey](https://help.nextcloud.com/u/jbilbrey)\
**Post date:** [July 12, 2021, 9:49pm UTC](https://help.nextcloud.com/t/ldap-mystery-cannot-even-test-base-dn/9372/10 "2021-07-12T21:49:02Z")

</div>

This was still relevant today when I was trying to get it to work on Rocky Linux. Thanks.

---

<div class="post-metadata">

**Author:** ![alv84](https://help.nextcloud.com/letter_avatar/alv84/32/5_5575768a8748004e209b776fc1b2916d.png) [@alv84](https://help.nextcloud.com/u/alv84)\
**Post date:** [October 16, 2021, 8:23am UTC](https://help.nextcloud.com/t/ldap-mystery-cannot-even-test-base-dn/9372/11 "2021-10-16T08:23:34Z")

</div>

Hi guys. i exactly the same problem but the point is i have no selinux present. i have ubuntu 20.04 with no selinux. output of `sestatus` command:

> # sestatus

> Command ‘sestatus’ not found, but can be installed with:

> apt install policycoreutils

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 2, 2024, 12:55pm UTC](https://help.nextcloud.com/t/ldap-mystery-cannot-even-test-base-dn/9372/12 "2024-12-02T12:55:53Z")

</div>



---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 9, 2024, 1:16pm UTC](https://help.nextcloud.com/t/ldap-mystery-cannot-even-test-base-dn/9372/13 "2024-12-09T13:16:59Z")

</div>


