Feature #756

Updated by Daniel Curtis over 4 years ago

This is a guide on how to setup LDAP authentication for users on ownCloud. The LDAP server is OpenLDAP on FreeBSD 9, but should work on any LDAP server.

h2. Populate the LDAP Server

* Create the People Organizational Unit ldif file:
vi ~/people-ou.ldif
#* And add the following:
dn: ou=People,dc=example,dc=com
objectclass: organizationalUnit
ou: People

* Import the People OU file into the server:
ldapadd -D "cn=Manager,dc=example,dc=com" -W -f ~/people-ou.ldif

* Create the bob user ldif file:
vi ~/bob.ldif
#* And add the following:
dn: cn=Bob Guy,ou=People,dc=example,dc=com
cn: Bob Guy
givenname: Bob
initials: BG
objectclass: inetOrgPerson
objectclass: organizationalPerson
objectclass: person
sn: Guy
uid: bob
userpassword: {MD5}X03MO1qnZdYdgyfeuILPmQ==
#* *NOTE*: The password for bob is *password*.

h2. Setup LDAP Authentication

*NOTE*: If using LDAP with SSL add the CA certificate used on the LDAP server, or else the connection will not succeed.

* Edit the ldap config file and add the CA certificate used on the LDAP server
vi /usr/local/etc/openldap/ldap.conf
#* And add the following:
TLS_CACERT /usr/local/etc/bundle.pem
#* *NOTE*: Add the CA certificate bundle to the bundle.pem file


*NOTE*: Make sure to set the LDAP users _uid_ to the group _memberUid_ attribute, or else owncloud will not be able to match the LDAP user and groups.

* Log into owncloud admin site, and go to +Apps -> Apps+ and click on *Not enabled*.

* Locate and enable *LDAP user and group backend*.

* Next go to +Username -> Admin+ and scroll to the LDAP section.
*# Host: **
*# Port: *389*
*# User DN: *cn=Manager,dc=example,dc=com*
*# Password: *SuperSecretPassword*
*# Base DN: *dc=example,dc=com*

* Click *Continue* and select all of the Object Classes in the Users tab.

* Then click *Continue* and select:
*# LDAP / AD Username: *[X]*
*# LDAP / AD Email Address: *[X]*

* Next click the +Advanced -> Directory Settings+ and select *_memberUid_* from the Group-Member association menu.

* Finally enter in the bob username and test if the connection works. If it does, try logging out and logging into owncloud using the bob user.

*NOTE*: If you are not using Active Directory, then you may not be using the MemberOf attribute. To disable the use of the MemberOf attribute run the following from the owncloud installation directory:
sudo -u www ./occ ldap:set-config "" useMemberOfToDetectMembership 0

h2. Resources