HOWTO: LDAP + ActiveDirectory instructions (with authentication) for Dolibarr 12

This took awhile to figure out, so I’ll document it here.

OS: Ubuntu 20.04
Dolibarr Version: 12.0.3


first you need to make sure you have php-ldap installed at your OS level:

sudo apt-get install php-ldap`
probably the easiest way for that.


  • Enable the “LDAP” module

On LDAP module settings panel “Global Parameters”…

  • Users and groups synchronization = LDAP -> Dolibarr
    (this is important – or your “Users” and “Groups” tabs will not appear!)
  • Contacts sync = No
  • Type = Actiuve Directory
  • Version = 3
  • Primary Server = ldap://
  • Secondary Server =
  • Server Port = 389
  • Server DN = dc=your,dc=example,dc=com
  • Use TLS = No
  • Administrator DN = cn=SVC_ACCOUNTLDAP,cn=Users, dc=your,dc=example,dc=com
    (we have a dedicated SVC_ACCOUNTLDAP used for LDAP read-only access)
  • Administrator password = password for above user.

Click “modify” to save, then
If it worked, move to next step. If not, resolve your issues.

Next step… still in LDAP Setup… for the module:

“Users” tab:

  • Users’ DN = dc=Users,dc=your,dc=example,dc=com
    (I have my users in their own OU different path than above)
  • List of objectClass = person
  • Search filter = &(objectclass=person)
    for mapping section I ONLY map…
  • Full name = cn
  • Login (samba, activedirectory) = samaccountname
    (CaSe MaTTers for above!)
  • Email address = mail

click “MODIFY” to save an then click “TEST A LDAP SEARCH”
If it worked and you see output with # of your users ending like…

useridentifier: samaccountname
required_fields: samaccountname,cn,mail
=> 62 records

Then great!

Now… when you have conifgured any other application in the world you may think you’re done here and start trying to log in to Dolibarr with LDAP because you think it should be working, right? Wrong. What you’ve actually done with the configuration so far, is allow yourself to “ADD USERS TO DOLIBARR” using LDAP search to find them and import them.

THAT should be working now… you can test it by…clicking “Users & Groups”
Then click “New user” button and on this new user screen, you should see drop down box…
"Users in LDAP database"

So here you should see your users now, right? Yes? Great.

Note: I have not use configured the “Groups” tab of LDAP module which may (or may not) allow automatic creation of LDAP-authenticated users in Dolibarr database. I know it will allow you to map Dolibarr roles/permissions based on membership of group. I am not planning to use “Groups” tab for now.

So here you SHOULD actually add new user from the LDAP drop down. Add the user you plan to test LDAP authentication with. Done? Ok great.

So now let’s deal with LDAP AUTHENTICATION , because that’s what we really wanted out of all of this.

Now you must go to server teminal prompt and:

sudo nano -w /path/to/dolibarr/htdocs/conf/conf.php

comment out the line for
; $dolibarr_main_authentication=‘dolibarr’;

and add the following to bottom of file… (with your own values)

$dolibarr_main_auth_ldap_admin_login=‘cn=SVC_ACCOUNTLDAP,cn=Users, dc=your,dc=example,dc=com’;

Save it and browse to dolibarr.

Try to log in with the LDAP user you added.

Now it works right? Good!

Awesome, had the same issues as i also assumed using LDAP->Dolibarr would allow you to login with LDAP accounts.
The settings also work fine with OpenLDAP, only need to change the login attribute to ‘uid’.

I was trying to use the Groups as well, but it seems that Groups dont really do anything when using direction LDAP->Dolibarr. On creating a new group there is no way to import the group from LDAP. However, based on the group name, Dolibarr can still read the LDAP entry if there exist a group with the same name. A bit strange.

I thought of managing the group assignments in ldap and have them automatically created when the users are imported to Dolibarr, instead of assigning members to groups that only exist in Dolibarr. Any idea if/how this might work?