<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/19/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Acacha</id>
	<title>MoodleDocs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/19/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Acacha"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/19/en/Special:Contributions/Acacha"/>
	<updated>2026-04-10T06:24:54Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/19/en/index.php?title=Upgrading&amp;diff=53676</id>
		<title>Upgrading</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/19/en/index.php?title=Upgrading&amp;diff=53676"/>
		<updated>2009-04-01T14:49:41Z</updated>

		<summary type="html">&lt;p&gt;Acacha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Moodle is designed to upgrade cleanly from one version to the next.  Please refer to [[Upgrading to Moodle 1.6]], [[Upgrading to Moodle 1.8]] or [[Upgrading to Moodle 1.9]]  for particular considerations related to the upgraded version.  &lt;br /&gt;
&lt;br /&gt;
Changes that have been made to the original code, such as installing a contributed module (non-standard module) or a site edit of a php file, may not upgrade. This includes modifications to standard themes, that will be overwritten during an upgrade.&lt;br /&gt;
&lt;br /&gt;
For those using cpanel, you can use [http://ic.eflclasses.org/tutorials/howtoupgrademoodlewithcpanel.swf this tutorial]. It is a bit rough around the edges and is a little dated, but you should get the idea.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
When upgrading a Moodle installation you should follow these steps:&lt;br /&gt;
&lt;br /&gt;
==Check the requirements==&lt;br /&gt;
Spend some time re-reading the [[Installing Moodle | installation documentation]] and documentation for the new version. Check the system requirements for the target version you want to upgrade-to in &#039;&#039;Administration &amp;gt; Server &amp;gt; [[Environment]]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Backup important data ==&lt;br /&gt;
&lt;br /&gt;
Although it is not strictly necessary, it is always a good idea to make a backup of any production system before a major upgrade, just in case you need to revert back to the older version for some reason. In fact, it&#039;s a good idea to automate your server to backup your Moodle installation daily, so that you can skip this step.&lt;br /&gt;
&lt;br /&gt;
There are three areas that need backing up:&lt;br /&gt;
&lt;br /&gt;
=== 1. The Moodle software directory itself ===&lt;br /&gt;
&lt;br /&gt;
Make a separate copy of these files before the upgrade, so that you can retrieve your config.php and any modules you have added like themes, languages etc&lt;br /&gt;
&lt;br /&gt;
=== 2. Your data directory ===&lt;br /&gt;
&lt;br /&gt;
This is where uploaded content resides (such as course resources and student assignments) so it is very important to have a backup of these files anyway. Sometimes upgrades may move or rename directories within your data directory.&lt;br /&gt;
&lt;br /&gt;
=== 3. Your database ===&lt;br /&gt;
&lt;br /&gt;
Most Moodle upgrades will alter the database tables, adding or changing fields. Each database has different ways to backup. One way of backing up a MySQL database is to &#039;dump&#039; it to a single SQL file. The following example shows Unix commands to dump the database called &amp;quot;moodle&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 mysqldump -u username -p -C -Q -e -a moodle &amp;gt; moodle-backup-2007-04-01.sql&lt;br /&gt;
(The &amp;quot;-a&amp;quot; switch is deprecated and should be replaced by &amp;quot;--create-options&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Substitute your database user account for username. The -p flag will prompt you for the password for the username specified by -u.&lt;br /&gt;
&lt;br /&gt;
If your database host is different from the host you want to execute the backup command (usually the web server), you have to specify it with the -h option to mysqldump:&lt;br /&gt;
&lt;br /&gt;
 mysqldump -u username -p -h databasehost -C -Q -e -a moodle &amp;gt; moodle-backup-2007-04-01.sql &lt;br /&gt;
&lt;br /&gt;
You can also use the &amp;quot;Export&amp;quot; feature in Moodle&#039;s optional &amp;quot;MySQL Admin&amp;quot; web interface to do the same thing on all platforms. In Moodle v1.9 and greater, this is located in &#039;&#039;&#039;Site Administration&#039;&#039;&#039; -&amp;gt; &#039;&#039;&#039;Server&#039;&#039;&#039; -&amp;gt; &#039;&#039;&#039;Database&#039;&#039;&#039;. This interface can also be downloaded from http://download.moodle.org/modules/integrations.php. It is an integration of PHPMyAdmin for the Moodle administration interface.&lt;br /&gt;
&lt;br /&gt;
==== SQL dump caveats ====&lt;br /&gt;
&lt;br /&gt;
* Please note that there are a &#039;&#039;&#039;LOT&#039;&#039;&#039; of options possible for mysqldump. Please talk with your Systems Administrator (if you have one) or similar to see if there are site-specific flags you should use for your SQL dump.&lt;br /&gt;
** For example, if your local installation is running MySQL 5.2 and you are moving to a system running MySQL 5.0 or 4.1, you really ought to use the &amp;quot;--compat=mysql40&amp;quot; flag. (This is not too uncommon of a situation given the nature of ISP hosting as compared to local user Moodle setups)&lt;br /&gt;
* This seems obvious, but should be said outright: These instructions only work for dumping from MySQL! Postgresql, Oracle, and other database servers have different tools to dump databases.&lt;br /&gt;
* Given the example mysql import lines, above, you really should use the --no-create-db flag. If your database locally is named something differently from the migration site, not including this flag could cause problems.&lt;br /&gt;
&lt;br /&gt;
== Install the new Moodle software ==&lt;br /&gt;
&lt;br /&gt;
=== Using a downloaded archive ===&lt;br /&gt;
&lt;br /&gt;
@Do not overwrite an old installation unless you know what you are doing ... sometimes old files can cause problems in new installations. The best way is to rename the current Moodle directory to something else, then unpack the new Moodle archive into the old location.&lt;br /&gt;
&lt;br /&gt;
 Linux&lt;br /&gt;
 mv moodle moodle.backup&lt;br /&gt;
 tar xvzf moodle-1.1.tgz&lt;br /&gt;
&lt;br /&gt;
Next, copy across your config.php, any other plugins such as custom themes, and your .htaccess file if you created one:&lt;br /&gt;
&lt;br /&gt;
 cp moodle.backup/config.php moodle&lt;br /&gt;
 cp -pr moodle.backup/theme/mytheme moodle/theme/mytheme&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to &lt;br /&gt;
&lt;br /&gt;
 sudo chown www-data moodle/config.php&lt;br /&gt;
&lt;br /&gt;
if necessary.&lt;br /&gt;
&lt;br /&gt;
where www-data is whatever user the Apache user is on your system. This is often &#039;apache&#039; or &#039;www&#039;.&lt;br /&gt;
You can find out by doing &#039;ls -l&#039; in your /var/www/moodle folder (or wherever your moodle site is)&lt;br /&gt;
and then looking at the owner and group.&lt;br /&gt;
&lt;br /&gt;
so you may see something like&lt;br /&gt;
&lt;br /&gt;
 ls -l&lt;br /&gt;
 ...lots of lines...&lt;br /&gt;
 -rw-r--r--   1 apache system     784 Jun 28  2007 config.php &lt;br /&gt;
 ...lots more lines...&lt;br /&gt;
&lt;br /&gt;
so the owner is apache and the group is system. &lt;br /&gt;
&lt;br /&gt;
To replicate this on your new system you can do  &#039;chown apache:system config.php&#039; &lt;br /&gt;
&lt;br /&gt;
or to do a whole group do&lt;br /&gt;
&lt;br /&gt;
 chown apache:system ./*&lt;br /&gt;
&lt;br /&gt;
and recursively&lt;br /&gt;
&lt;br /&gt;
 chown -R apache:system ./*&lt;br /&gt;
&lt;br /&gt;
=== Using CVS ===&lt;br /&gt;
&lt;br /&gt;
You can use CVS for updating or upgrading your Moodle.&lt;br /&gt;
First you need to do a CVS checkout in your (empty) Moodle root directory.&lt;br /&gt;
&lt;br /&gt;
You can use any of our [[CVS_for_Administrators#CVS_Servers|CVS Mirror servers]]. Just replace &#039;&#039;&#039;SERVER.cvs.moodle.org&#039;&#039;&#039; in the instructions below with the name of the mirror server you chose!.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For Linux servers&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To do a CVS checkout of Moodle, you first have to logon to the Moodle CVS server.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;cvs -d:pserver:anonymous@SERVER.cvs.moodle.org:/cvsroot/moodle login&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  No password for anonymous, so just hit the Enter button.&lt;br /&gt;
&lt;br /&gt;
Go to the directory where you want the Moodle root to come and type&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;cvs -z3 -d:pserver:anonymous@SERVER.cvs.moodle.org:/cvsroot/moodle co -r MOODLE_18_STABLE moodle&amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  (where MOODLE_18_STABLE is the desired version)&lt;br /&gt;
&lt;br /&gt;
To update, just go into the Moodle root directory and update to the new files:&lt;br /&gt;
&lt;br /&gt;
  cvs update -dP&lt;br /&gt;
To update to a new version type in the following and change 18 to whatever newest version upgrade number is&lt;br /&gt;
  cvs -Q update -dP -r MOODLE_18_STABLE&lt;br /&gt;
&lt;br /&gt;
Make sure you use the &amp;quot;d&amp;quot; parameter to create new directories if necessary, and the &amp;quot;P&amp;quot; parameter to prune empty directories.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For Windows servers&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You can use Tortoise CVS to do the initial checkout and the updates.&lt;br /&gt;
&lt;br /&gt;
If you have been editing Moodle files, watch the messages very closely for possible conflicts. All your customised themes and non-standard plugins will be untouched.&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to visit the admin page after the CVS update process has completed.&lt;br /&gt;
&lt;br /&gt;
== Finishing the upgrade ==&lt;br /&gt;
&lt;br /&gt;
The last step is to trigger the upgrade processes within Moodle.&lt;br /&gt;
&lt;br /&gt;
To do this just visit the admin page of your installation e.g. &#039;&#039;&amp;lt;nowiki&amp;gt;http://example.com/moodle/admin&amp;lt;/nowiki&amp;gt;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
It doesn&#039;t matter if you are logged in as admin or not. If you are upgrading from some older versions you would not be able to login before the upgrade anyway.&lt;br /&gt;
&lt;br /&gt;
Moodle will automatically detect the new version and perform all the database or filesystem upgrades that are necessary. If there is anything it can&#039;t do itself (very rare) then you will see messages telling you what you need to do.&lt;br /&gt;
&lt;br /&gt;
Assuming all goes well (no error messages) then you can start using your new version of Moodle and enjoy the new features!&lt;br /&gt;
&lt;br /&gt;
Please note that if you are running a large scale of moodle site (e.g. have more tha 10,000+ courses and 40,000+ users), make sure that you do your own performance profiling testing before you upgrade to Moodle 1.8.x, as there are still quite a few outstanding (unresolved) performance issues in 1.8.x for large user base installations.&lt;br /&gt;
&lt;br /&gt;
== Verify the upgrade (optional) ==&lt;br /&gt;
&lt;br /&gt;
If you wish to confirm that the database definitions in the upgraded database match the definitions of a new, clean install (which they should) you might like to look at [[Verify Database Schema]].&lt;br /&gt;
&lt;br /&gt;
==Upgrading more than one version==&lt;br /&gt;
&lt;br /&gt;
In general, it is recommended to upgrade via each version of Moodle, for example 1.7 -&amp;gt; 1.8 -&amp;gt; 1.9. An exception to this is when upgrading from 1.5 or 1.6, when it is recommended that 1.7 is skipped, in other words upgrade 1.5 -&amp;gt; 1.6 -&amp;gt; 1.8 -&amp;gt; 1.9. (The main reason for this recommendation is that the default roles settings obtained when upgrading to 1.7 are not ideal for 1.8 onwards.)&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[[Installing Moodle]]&lt;br /&gt;
*[[Installation FAQ]]&lt;br /&gt;
*[[Upgrading to Moodle 1.6]]&lt;br /&gt;
*[[Upgrading to Moodle 1.8]]&lt;br /&gt;
*[[Upgrading to Moodle 1.9]]&lt;br /&gt;
*[[Upgrading to Moodle 2.0]]&lt;br /&gt;
*[[Environment]]&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/view.php?id=28 Installation problems] forum&lt;br /&gt;
*[http://otaru-jc.ac.jp/hagley/howtoupgrademoodlewithcpanel.swf How to upgrade Moodle with cpanel tutorial]&lt;br /&gt;
&lt;br /&gt;
Using Moodle forum discussions:&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=26731&amp;amp;parent=125858 Using cvs]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=56915 Upgrading from 1.5.2 to 1.7]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=56991 Upgrade nightmares.... any help appreciated]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=62463 After upgrading i get &amp;quot;Your site may not be secure.&amp;quot; msg]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=104887 Best practices for QA]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[es:Actualización de moodle]]&lt;br /&gt;
[[fr:Mise à jour]]&lt;br /&gt;
[[ja:アップグレード]]&lt;br /&gt;
[[nl:Upgraden]]&lt;br /&gt;
[[zh:升级]]&lt;br /&gt;
[[pl:Aktualizacja]]&lt;br /&gt;
[[de:Aktualisierung von Moodle]]&lt;/div&gt;</summary>
		<author><name>Acacha</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/19/en/index.php?title=LDAP_authentication&amp;diff=16386</id>
		<title>LDAP authentication</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/19/en/index.php?title=LDAP_authentication&amp;diff=16386"/>
		<updated>2006-09-27T09:46:16Z</updated>

		<summary type="html">&lt;p&gt;Acacha: /* ldap auth_user_create() only suports Novell */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This document describes how to set up LDAP authentication in Moodle. You can find a [[#Basic Scenario|Basic Scenario]], where everything is simple and straightforward, and that should be enough for most installations. If your installation is a little bigger and you are using multiple LDAP servers, or multiple locations (contexts) for your users in your LDAP tree, then have a look at the [[#Advanced Scenarios|Advanced Scenarios]].&lt;br /&gt;
&lt;br /&gt;
==Basic Scenario==&lt;br /&gt;
&lt;br /&gt;
===Assumptions===&lt;br /&gt;
&lt;br /&gt;
# Your Moodle site is located at &#039;&#039;&#039;http://your.moodle.site/&#039;&#039;&#039;&lt;br /&gt;
# You have configured your PHP installation with the LDAP extension. It is loaded and activated, and it shows when you go to &#039;&#039;&#039;http://your.moodle.site/admin/phpinfo.php&#039;&#039;&#039; (logged in as user &#039;admin&#039;).&lt;br /&gt;
# Your LDAP server has &#039;&#039;&#039;192.168.1.100&#039;&#039;&#039; as its IP address.&lt;br /&gt;
# You are not using LDAP with SSL (also known as LDAPS) in your settings. This might prevent certain operations from working (e.g., you cannot update data if you are using MS Active Directory -- MS-AD from here on --), but should be OK if you just want to authenticate your users.&lt;br /&gt;
# You don&#039;t want your users to change their passwords the first time they log in into Moodle.&lt;br /&gt;
# You are using a single domain as the source of your authentication data in case you are using MS-AD (more on this in the Appendices).&lt;br /&gt;
# You are using a top level distinguished name (DN) of &#039;&#039;&#039;dc=my,dc=organization,dc=domain&#039;&#039;&#039; as the root of your LDAP tree. &lt;br /&gt;
# You have a non-privileged LDAP user account you will use to bind to the LDAP server. This is not necessary with certain LDAP servers, but MS-AD requires this and it won&#039;t hurt if you use it even if your LDAP server doesn&#039;t need it. Make sure &#039;&#039;&#039;this account and its password don&#039;t expire&#039;&#039;&#039;, and make this password as strong as possible. Remember you only need to type this password once, when configuring Moodle, so don&#039;t be afraid of making it as hard to guess as possible. Let&#039;s say this user account has a DN of &#039;&#039;&#039;cn=ldap-user,dc=my,dc=organization,dc=domain&#039;&#039;&#039;, and password &#039;&#039;&#039;hardtoguesspassword&#039;&#039;&#039;.&lt;br /&gt;
# All of your Moodle users are in an organizational unit (OU) called &#039;&#039;&#039;moodleusers&#039;&#039;&#039;, which is right under your LDAP root. That OU has a DN of &#039;&#039;&#039;ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039;.&lt;br /&gt;
# You &#039;&#039;&#039;don&#039;t&#039;&#039;&#039; want your LDAP users&#039; passwords to be stored in Moodle at all.&lt;br /&gt;
&lt;br /&gt;
===Configuring Moodle authentication===&lt;br /&gt;
&lt;br /&gt;
Log in as an admin user and go to Administration &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication. In the drop down listbox titled  &amp;quot;Choose an authentication method&amp;quot; select &amp;quot;Use an LDAP Server&amp;quot;. You will get a page similar to this one:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::: [[Image:auth_ldap_config_screenshot.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, you just have to fill in the values. Let&#039;s go step by step.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| ldap_host_url&lt;br /&gt;
| As the IP of your LDAP server is 192.168.1.100, type &amp;quot;&#039;&#039;&#039;ldap://192.168.1.100&#039;&#039;&#039;&amp;quot; (without the quotes).&lt;br /&gt;
|-&lt;br /&gt;
| ldap_version&lt;br /&gt;
| Unless you are using a really old LDAP server, &#039;&#039;&#039;version 3&#039;&#039;&#039; is the one you should choose.&lt;br /&gt;
|-&lt;br /&gt;
| ldap_preventpassindb&lt;br /&gt;
| As you &#039;&#039;&#039;don&#039;t&#039;&#039;&#039; want to store the users&#039;s password in Moodle&#039;s database, choose &#039;&#039;&#039;Yes&#039;&#039;&#039; here.&lt;br /&gt;
|-&lt;br /&gt;
| ldap_bind_dn&lt;br /&gt;
| This is the distinguished name of the bind user defined above. Just type &amp;quot;&#039;&#039;&#039;cn=ldap-user,dc=my,dc=organization,dc=domain&#039;&#039;&#039;&amp;quot; (without the quotes).&lt;br /&gt;
|-&lt;br /&gt;
| ldap_bind_pw&lt;br /&gt;
| This is the bind user password defined above. Type &amp;quot;&#039;&#039;&#039;hardtoguesspassword&#039;&#039;&#039;&amp;quot; (without the quotes).&lt;br /&gt;
|-&lt;br /&gt;
| ldap_user_type&lt;br /&gt;
| Choose: &lt;br /&gt;
* &#039;&#039;&#039;Novel Edirectory&#039;&#039;&#039; if your LDAP server is running Novell&#039;s eDdirectory.&lt;br /&gt;
* &#039;&#039;&#039;posixAccount (rfc2307)&#039;&#039;&#039; if your LDAP server is running a RFC-2307 compatible LDAP server (choose this is your server is running OpenLDAP).&lt;br /&gt;
* &#039;&#039;&#039;posixAccount (rfc2307bis)&#039;&#039;&#039; if your LDAP server is running a RFC-2307bis compatible LDAP server.&lt;br /&gt;
* &#039;&#039;&#039;sambaSamAccount (v.3.0.7)&#039;&#039;&#039; if your LDAP server is running with SAMBA&#039;s 3.x LDAP schema extension and you want to use it.&lt;br /&gt;
* &#039;&#039;&#039;MS ActiveDirectory&#039;&#039;&#039; if your LDAP server is running Microsoft&#039;s Active Directory (MS-AD)&lt;br /&gt;
|-&lt;br /&gt;
| ldap_contexts&lt;br /&gt;
| The DN of the context (container) where all of your Moodle users are found. Type &#039;&#039;&#039;ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039; here.&lt;br /&gt;
|-&lt;br /&gt;
| ldap_search_sub&lt;br /&gt;
| If you have any sub organizational units (subcontexts) hanging from &#039;&#039;&#039;ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039; and you want Moodle to search there too, set this to &#039;&#039;&#039;yes&#039;&#039;&#039;. Otherwise, set this to &#039;&#039;&#039;no&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| ldap_opt_deref&lt;br /&gt;
| Sometimes your LDAP server will tell you that the real value you are searching for is in fact in another part of the LDAP tree (this is called an alias). If you want Moodle to &#039;dereference&#039; the alias and fetch the real value from the original location, set this to &#039;&#039;&#039;yes&#039;&#039;&#039;. If you don&#039;t want Moodle to dereference it, set this to &#039;&#039;&#039;no&#039;&#039;&#039;. If you are using MS-AD, set this to &#039;&#039;&#039;no&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| ldap_user_attribute&lt;br /&gt;
| The attribute used to name/search users in your LDAP tree. This option takes a default value based on the &#039;&#039;ldap_user_type&#039;&#039; value you choosed above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in&amp;lt;/u&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
By the way, it&#039;s usually &#039;&#039;&#039;cn&#039;&#039;&#039; (Novell eDirectory and MS-AD) or &#039;&#039;&#039;uid&#039;&#039;&#039; (RFC-2037, RFC-2037bis and SAMBA 3.x LDAP extension), but if you are using MS-AD you could use &#039;&#039;&#039;sAMAccountName&#039;&#039;&#039; (the pre-Windows 2000 logon account name) if you need too.&lt;br /&gt;
|-&lt;br /&gt;
| ldap_memberattribute&lt;br /&gt;
| The attribute used to list the members of a given group. This option takes a default value based on the &#039;&#039;ldap_user_type&#039;&#039; value you choosed above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By the way, the usual values are &#039;&#039;&#039;member&#039;&#039;&#039; and &#039;&#039;&#039;memberUid&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| ldap_objectclass&lt;br /&gt;
| The type of LDAP object used to search for users. This option takes a default value based on the &#039;&#039;ldap_user_type&#039;&#039; value you choosed above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here are the default values for each of the &#039;&#039;ldap_user_type&#039;&#039; values:&lt;br /&gt;
* &#039;&#039;&#039;User&#039;&#039;&#039; for Novel eDirectory&lt;br /&gt;
* &#039;&#039;&#039;posixAccount&#039;&#039;&#039; for RFC-2037 and RFC-2037bis&lt;br /&gt;
* &#039;&#039;&#039;sambaSamAccount&#039;&#039;&#039; for SAMBA 3.0.x LDAP extension&lt;br /&gt;
* &#039;&#039;&#039;user&#039;&#039;&#039; for MS-AD&lt;br /&gt;
|-&lt;br /&gt;
| Force change password&lt;br /&gt;
| Set this to &#039;&#039;Yes&#039;&#039; if you want to force your users to change their password on the first login into Moodle. Otherwise, set this to &#039;&#039;no&#039;&#039;. Bear in mind the password they are forced to change is the one stored in your LDAP server.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;As you don&#039;t want your users to change their passwords in their first login, leave this set to &#039;&#039;No&#039;&#039;&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Use standard Change Password Page&lt;br /&gt;
|&lt;br /&gt;
* Setting this to &#039;&#039;Yes&#039;&#039; makes Moodle use it&#039;s own standard password change page, everytime users want to change their passwords.&lt;br /&gt;
* Setting this to &#039;&#039;No&#039;&#039; makes Moodle use the the page specified in the field called &amp;quot;Change password URL&amp;quot; (at the bottom of the configuration page).&lt;br /&gt;
&lt;br /&gt;
Bear in mind that changing your LDAP passwords from Moodle might require a LDAPS connection (this is true at least for MS-AD).&lt;br /&gt;
&lt;br /&gt;
Also, code for changing passwords from Moodle for anything but Novell eDirectory is almost not tested, so this may or may not work for other LDAP servers.&lt;br /&gt;
|-&lt;br /&gt;
| ldap_expiration&lt;br /&gt;
| &lt;br /&gt;
* Setting this to &#039;&#039;No&#039;&#039; will make Moodle not to check if the password of the user has expired or not.&lt;br /&gt;
* Setting this to &#039;&#039;LDAP&#039;&#039; will make Moodle check if the LDAP password of the user has expired or not, and warn her a number of days before the password expires.&lt;br /&gt;
&lt;br /&gt;
Current code only deals with Novell eDirectory LDAP server, but there is a patch floating around to make it work with MS-AD too (search in the authentication forum).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;So unless you have Novell eDirectory server (or use the patch), choose &#039;&#039;No&#039;&#039; here.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| ldap_expiration_warning&lt;br /&gt;
| This value sets how many days in advance of password expiration the user is warned that her password is about to expire.&lt;br /&gt;
|-&lt;br /&gt;
| ldap_exprireattr&lt;br /&gt;
| The LDAP user attribute used to check password expiration. This option takes a default value based on the &#039;&#039;ldap_user_type&#039;&#039; value you choosed above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| ldap_gracelogins&lt;br /&gt;
| This setting is specific to Novell eDirectory. If set to &#039;&#039;Yes&#039;&#039;, enable LDAP gracelogin support. After password has expired the user can login until gracelogin count is 0.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;So unless you have Novell eDirectory server and want to allow gracelogin support, choose &#039;&#039;No&#039;&#039; here.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| ldap_graceattr&lt;br /&gt;
| This setting is currently not used in the code (and is specific to Novell eDirectory). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;So you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| ldap_create_context&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| ldap_creators&lt;br /&gt;
| The DN of the group that contains all of your Moodle creators. This is typically a posixGroup with a &amp;quot;memberUid&amp;quot; attribute for each user you want to be a creator.  If your group is called &#039;&#039;creators&#039;&#039;, type &#039;&#039;&#039;cn=creators,ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039; here.  Each memberUid attribute contains the CN of a user who is authorized to be a creator.  Do not use the user&#039;s full DN (e.g.,  not &#039;&#039;&#039;memberUid: cn=JoeTeacher,ou=moodleusers,dc-my,dc=organizations,dc=domain&#039;&#039;&#039;, but rather &#039;&#039;&#039;memberUid: JoeTeacher&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
In eDirectory, the objectClass for a group is (by default) not &#039;&#039;&#039;posixGroup&#039;&#039;&#039; but &#039;&#039;&#039;groupOfNames,&#039;&#039;&#039; whose member attribute is &#039;&#039;&#039;member,&#039;&#039;&#039; not &#039;&#039;&#039;memberUid,&#039;&#039;&#039; and whose value is the full DN of the user in question.  Although you can probably modify Moodle&#039;s code to use this field, a better solution is just to add a new &#039;&#039;&#039;objectClass&#039;&#039;&#039; attribute of &#039;&#039;&#039;posixGroup&#039;&#039;&#039; to your creators group and put the CNs for each creator in a &#039;&#039;&#039;memberUid&#039;&#039;&#039; attribute.&lt;br /&gt;
&lt;br /&gt;
In MS Active Directory, you will need to create a security group for your creators to be part of and then add them all. If your ldap context above is &#039;ou=staff,dc=my,dc=org&#039; then your group should then be &#039;cn=creators,ou=staff,dc=my,dc=org&#039;. If some of the users are from other contexts and have been added to the same security group, you&#039;ll have to add these as separate contexts after the first one using the same format.&lt;br /&gt;
|-&lt;br /&gt;
| First name&lt;br /&gt;
| The name of the attribute that holds the first name of your users in your LDAP server. This is usually &#039;&#039;&#039;givenName&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Surname&lt;br /&gt;
| The name of the attribute that holds the surname of your users in your LDAP server. This is usually &#039;&#039;&#039;sn&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Email address&lt;br /&gt;
| The name of the attribute that holds the email address of your users in your LDAP server. This is usually &#039;&#039;&#039;mail&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Phone 1&lt;br /&gt;
| The name of the attribute that holds the telephone number of your users in your LDAP server. This is usually &#039;&#039;&#039;telephoneNumber&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Phone 2&lt;br /&gt;
|  The name of the attribute that holds an additional telephone number of your users in your LDAP server. This can be &#039;&#039;&#039;homePhone&#039;&#039;&#039;, &#039;&#039;&#039;mobile&#039;&#039;&#039;, &#039;&#039;&#039;pager&#039;&#039;&#039;, &#039;&#039;&#039;facsimileTelephoneNumber&#039;&#039;&#039; or even others.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Department&lt;br /&gt;
| The name of the attribute that holds the department name of your users in your LDAP server. This is usully &#039;&#039;&#039;departmentNumber&#039;&#039;&#039; (for posixAccount and maybe eDirectory) or &#039;&#039;&#039;department&#039;&#039;&#039; (for MS-AD).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Address&lt;br /&gt;
| The name of the attribute that holds the street address of your users in your LDAP server. This is usully &#039;&#039;&#039;streetAddress&#039;&#039;&#039; or &#039;&#039;&#039;street&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| City/town&lt;br /&gt;
| The name of the attribute that holds the city/town of your users in your LDAP server. This is usully &#039;&#039;&#039;l&#039;&#039;&#039; (lowercase L) or &#039;&#039;&#039;localityName&#039;&#039;&#039; (not valid in MS-AD).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| Country&lt;br /&gt;
| The name of the attribute that holds the couuntry of your users in your LDAP server. This is usully &#039;&#039;&#039;c&#039;&#039;&#039; or &#039;&#039;&#039;countryName&#039;&#039;&#039; (not valid in MS-AD).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Description&lt;br /&gt;
| &#039;&#039;&#039;description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| ID Number&lt;br /&gt;
| &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Language&lt;br /&gt;
| &#039;&#039;&#039;preferredLanguage&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Instructions&lt;br /&gt;
| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The rest of the fields are common to all authentication methods and will not be discussed here.&lt;br /&gt;
&lt;br /&gt;
==Advanced Scenarios==&lt;br /&gt;
&lt;br /&gt;
===Using multiple LDAP Servers===&lt;br /&gt;
Entering more than one name in the ldap_host_url field can provide some sort of resilience to your system. Simply use the syntax :&lt;br /&gt;
ldap://my.first.server ; ldap://my.second.server ; ...&lt;br /&gt;
&lt;br /&gt;
Of course, this will only work if all the servers share the same directory information, using a replication or synchronization mecanism once introduced in eDirectory and now generalized to the main LDAP-compatible directories.&lt;br /&gt;
&lt;br /&gt;
There is one drawback in Moodle 1.5 - 1.6 implementation of LDAP authentication : the auth_ldap_connect() function processes the servers sequentially, not in a round robin mode. Thus, if the primary server fails, you will have to wait for the connection to time out before switching to the following one.&lt;br /&gt;
&lt;br /&gt;
===Using multiple user locations (contexts) in your LDAP tree===&lt;br /&gt;
There is no need to use multiple user locations if your directory tree is flat, i.e. if all user accounts reside in a &#039;&#039;&#039;ou=people,dc=my,dc=organization,dc=domain&#039;&#039;&#039; or &#039;&#039;&#039;ou=people,o=myorg&#039;&#039;&#039; container. &lt;br /&gt;
&lt;br /&gt;
At the opposite, if you use the ACL mecanism to delegate user management, there are chances that your users will be stored in containers like &#039;&#039;&#039;ou=students,ou=dept1,o=myorg&#039;&#039;&#039; and &#039;&#039;&#039;ou=students,ou=dept2,o=myorg&#039;&#039;&#039; ...&lt;br /&gt;
&lt;br /&gt;
Then there is an alternative :&lt;br /&gt;
* Look at the &#039;&#039;&#039;o=myorg&#039;&#039;&#039; level with the ldap_search_sub attribute set to &#039;&#039;&#039;yes&#039;&#039;&#039;.&lt;br /&gt;
* Set the ldap_context to &#039;&#039;&#039;ou=students,ou=dept1,o=myorg ; ou=students,ou=dept2,o=myorg&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Choosing between these two solutions supposes some sort of benchmarking, as the result depends heavily on the structure of your directory tree &#039;&#039;&#039;and&#039;&#039;&#039; on your LDAP software indexing capabilities. Simply note that there is a probability in such deep trees that two users share the same &#039;&#039;common name&#039;&#039; (cn), while having different &#039;&#039;distinguished names&#039;&#039;. Then only the second solution will have a deterministic result (returning allways the same user).&lt;br /&gt;
&lt;br /&gt;
===Using LDAPS (LDAP + SSL)===&lt;br /&gt;
====MS Active Directory + SSL ====&lt;br /&gt;
&lt;br /&gt;
If the Certificate Authority is not installed you&#039;ll have to install it first as follows:&lt;br /&gt;
# Click &#039;&#039;&#039;Start&#039;&#039;&#039; -&amp;gt; &#039;&#039;&#039;Control Panel&#039;&#039;&#039; -&amp;gt; &#039;&#039;&#039;Add or Remove programs.&#039;&#039;&#039;&lt;br /&gt;
# Click &#039;&#039;&#039;Add/Remove Windows Components&#039;&#039;&#039; and select &#039;&#039;&#039;Certificate Services.&#039;&#039;&#039;&lt;br /&gt;
# Follow the procedure provided to install the &#039;&#039;&#039;Certificate Authority&#039;&#039;&#039;. Enterprise level is a good choice.&lt;br /&gt;
&lt;br /&gt;
Verify that SSL has been enabled on the server by installing suptools.msi from Windows installation cd&#039;s \Support\tools directory. After support tools installation:&lt;br /&gt;
# Select &#039;&#039;&#039;Start&#039;&#039;&#039; -&amp;gt; &#039;&#039;&#039;Run&#039;&#039;&#039;, write &#039;&#039;&#039;ldp&#039;&#039;&#039; in the Open field.&lt;br /&gt;
# From the ldp window select &#039;&#039;&#039;Connection&#039;&#039;&#039; -&amp;gt; &#039;&#039;&#039;Connect&#039;&#039;&#039; and supply valid hostname and port number &#039;&#039;&#039;636&#039;&#039;&#039;. Also select the SSL check box.&lt;br /&gt;
&lt;br /&gt;
If successful, you should get information about the connection.&lt;br /&gt;
&lt;br /&gt;
Next step is to tell PHP&#039;s OpenLDAP extension to disable SSL certificate checking. On Windows servers you&#039;re most likely using pre-compiled PHP version, where you must create a path &#039;&#039;C:\OpenLDAP\sysconf&#039;&#039;. In this path create a file called &amp;quot;ldap.conf&amp;quot; with content:&lt;br /&gt;
&lt;br /&gt;
 TLS_REQCERT never.&lt;br /&gt;
&lt;br /&gt;
Now you should be able to use &#039;&#039;&#039;ldaps://&#039;&#039;&#039; when connecting to MS-AD.&lt;br /&gt;
&lt;br /&gt;
==Appendices==&lt;br /&gt;
&lt;br /&gt;
===Child Domains and the Global Catalog in MS Active Directory===&lt;br /&gt;
&lt;br /&gt;
Moodle currently only has limited support for multiple domain controllers; specifically it expects each of the LDAP servers listed to contain identical sets of information. If you have users in multiple domains this presents an issue. One solution when working with MS-AD is to use the Global Catalog. The Global Catalog is designed to be a read-only, partial representation of an entire MS-AD forest, designed for searching the entire directory when the domain of the required object is not known.&lt;br /&gt;
&lt;br /&gt;
For example your organisation has a main domain example.org, staff and students are contained in two child domains staff.example.org and students.example.org. The 3 domains (example.org, staff.example.org and students.example.org) each have a domain controller (dc01, dc02 and dc03 respectively.) Each domain controller contains a full, writable, representation of only the objects that belong to its domain. However, assuming that the Global Catalog has been enabled (see below) on one of the domain controllers (for example dc01) a query to the Global Catalog would reveal matching objects from all three domains. The Global Catalog is automatically maintained through replication across the active directory forest, it can also be enabled on multiple servers (if, for example, you need redundancy / load balancing.)&lt;br /&gt;
&lt;br /&gt;
To make use of this in Moodle to allow logins from multiple domains is simple. The Global Catalog runs on port 3268 as opposed to 389 for standard LDAP queries. As a result, still assuming the Global Catalog is running on dc01, the &#039;&#039;&#039;&#039;ldap_host_url&#039;&#039;&#039;&#039; would be &#039;&#039;ldap://dc01.example.org:3268&#039;&#039;. The rest of the settings are the same as for other MS-AS Auth setups.&lt;br /&gt;
&lt;br /&gt;
You should use the &#039;&#039;&#039;&#039;ldap_contexts&#039;&#039;&#039;&#039; setting to indicate the locations of individuals you wish to grant access. To extend the example above a little: In the example.org domain users are all in the&#039;&#039; &#039;Users&#039; &#039;&#039;OU, in the staff.example.org domain users are in two OUs at the root of the domain,&#039;&#039; &#039;Support Staff&#039; &#039;&#039;and&#039;&#039; &#039;Teaching Staff&#039; &#039;&#039;, and in the students.example.org domain students are in an OU indicating the year that they enrolled, all of which are under the&#039;&#039; &#039;Students&#039; &#039;&#039;OU. As a result our &#039;&#039;&#039;&#039;ldap_contexts&#039;&#039;&#039;&#039; setting may look a little like this:&#039;&#039; &#039;OU=Users,DC=example,DC=org; OU=Support Staff,DC=staff,DC=example,DC=org; OU=Teaching Staff,DC=staff,DC=example,DC=org; OU=Students,DC=students,DC=example,DC=org&#039;&#039;.&#039; The &#039;&#039;&#039;&#039;ldap_search_sub&#039;&#039;&#039;&#039; option should be set to&#039;&#039; &#039;Yes&#039; &#039;&#039;to allow moodle to search within the child OUs.&lt;br /&gt;
&lt;br /&gt;
Its worth noting that the Global Catalog only contains a partial representation of the attributes of each object, as defined in the Partial Attribute Set supplied by Microsoft. However common information likely to be of use to a general Moodle installation (Forename, Surname, Email Address, sAMAccountName etc) is included in the set. For specific needs the schema can be altered to remove or add various attributes.&lt;br /&gt;
&lt;br /&gt;
In most cases the Global Catalog is read-only, update queries must be made over the standard LDAP ports to the domain controller that holds the object in question (in our example, updating a student&#039;s details would require an LDAP query to the students.example.org domain controller - dc03, it would not be possible to update details by querying the Global Catalog.) The exception to this would be in an environment where there is only a single domain in the active directory forest; in this case the Global Catalog holds a writable full set of attributes for each object in the domain. However, for the purposes of Moodle authorisation, there would be no need to use the Global Catalog in this case.&lt;br /&gt;
&lt;br /&gt;
====Enabling the Global Catalog====&lt;br /&gt;
&lt;br /&gt;
The Global Catalog is available on Windows 2000 and Windows 2003 Active Directory servers. To enable, open the ‘Active Directory Sites and Services’ MMC (Microsoft Management Console) snap-in. Extend ‘Sites’ and then the name of the Site containing the active directory forest you wish to use. Expand the server you wish to enable the Global Catalog on, right click ‘NTDS settings’ and select the ‘Properties’ tab. To enable, simply click the ‘Global Catalog’ checkbox. Under a Windows 2000 server it is necessary to restart the server (although it won’t prompt you to); under Windows 2003 server it is not necessary to restart the server. In either case you will generally have to wait for the AD forest to replicate before the Global Catalog offers a representation of the entire AD forest. Changes made in Active Directory will also be subject to a short delay due to the latency involved with replication. If your AD servers are firewalled port 3268 will need to be opened for Global Catalog servers.&lt;br /&gt;
If your organisation uses Microsoft Exchange then it its highly likely that at least one Domain Controller will already have Global Catalog enabled – Exchange 2000 and 2003 rely on the Global Catalog for address information, users also access the Global Catalog when using the GAL (Global Address List)&lt;br /&gt;
&lt;br /&gt;
====ldap auth_user_create() only suports Novell====&lt;br /&gt;
&lt;br /&gt;
After configuring user authentication with ldap I realized ldap only support edir (Novell) when combining ldap an email user confirmation. For example in my case (I use openldap) I have the following error after filling the user form:&lt;br /&gt;
&lt;br /&gt;
auth: ldap auth_user_create() does not support selected usertype:&amp;quot;rfc2307&amp;quot; (..yet)&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[http://moodle.org/mod/forum/view.php?id=42 Using Moodle: User authentication] forum&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=32168 PHP LDAP module does not seem to be present] forum discussion&lt;br /&gt;
* [[LDAP enrolment]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Administrator]]&lt;br /&gt;
[[Category:Authentication]]&lt;/div&gt;</summary>
		<author><name>Acacha</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/19/en/index.php?title=LDAP_authentication&amp;diff=16384</id>
		<title>LDAP authentication</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/19/en/index.php?title=LDAP_authentication&amp;diff=16384"/>
		<updated>2006-09-27T09:41:23Z</updated>

		<summary type="html">&lt;p&gt;Acacha: /* Appendices */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This document describes how to set up LDAP authentication in Moodle. You can find a [[#Basic Scenario|Basic Scenario]], where everything is simple and straightforward, and that should be enough for most installations. If your installation is a little bigger and you are using multiple LDAP servers, or multiple locations (contexts) for your users in your LDAP tree, then have a look at the [[#Advanced Scenarios|Advanced Scenarios]].&lt;br /&gt;
&lt;br /&gt;
==Basic Scenario==&lt;br /&gt;
&lt;br /&gt;
===Assumptions===&lt;br /&gt;
&lt;br /&gt;
# Your Moodle site is located at &#039;&#039;&#039;http://your.moodle.site/&#039;&#039;&#039;&lt;br /&gt;
# You have configured your PHP installation with the LDAP extension. It is loaded and activated, and it shows when you go to &#039;&#039;&#039;http://your.moodle.site/admin/phpinfo.php&#039;&#039;&#039; (logged in as user &#039;admin&#039;).&lt;br /&gt;
# Your LDAP server has &#039;&#039;&#039;192.168.1.100&#039;&#039;&#039; as its IP address.&lt;br /&gt;
# You are not using LDAP with SSL (also known as LDAPS) in your settings. This might prevent certain operations from working (e.g., you cannot update data if you are using MS Active Directory -- MS-AD from here on --), but should be OK if you just want to authenticate your users.&lt;br /&gt;
# You don&#039;t want your users to change their passwords the first time they log in into Moodle.&lt;br /&gt;
# You are using a single domain as the source of your authentication data in case you are using MS-AD (more on this in the Appendices).&lt;br /&gt;
# You are using a top level distinguished name (DN) of &#039;&#039;&#039;dc=my,dc=organization,dc=domain&#039;&#039;&#039; as the root of your LDAP tree. &lt;br /&gt;
# You have a non-privileged LDAP user account you will use to bind to the LDAP server. This is not necessary with certain LDAP servers, but MS-AD requires this and it won&#039;t hurt if you use it even if your LDAP server doesn&#039;t need it. Make sure &#039;&#039;&#039;this account and its password don&#039;t expire&#039;&#039;&#039;, and make this password as strong as possible. Remember you only need to type this password once, when configuring Moodle, so don&#039;t be afraid of making it as hard to guess as possible. Let&#039;s say this user account has a DN of &#039;&#039;&#039;cn=ldap-user,dc=my,dc=organization,dc=domain&#039;&#039;&#039;, and password &#039;&#039;&#039;hardtoguesspassword&#039;&#039;&#039;.&lt;br /&gt;
# All of your Moodle users are in an organizational unit (OU) called &#039;&#039;&#039;moodleusers&#039;&#039;&#039;, which is right under your LDAP root. That OU has a DN of &#039;&#039;&#039;ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039;.&lt;br /&gt;
# You &#039;&#039;&#039;don&#039;t&#039;&#039;&#039; want your LDAP users&#039; passwords to be stored in Moodle at all.&lt;br /&gt;
&lt;br /&gt;
===Configuring Moodle authentication===&lt;br /&gt;
&lt;br /&gt;
Log in as an admin user and go to Administration &amp;gt;&amp;gt; Users &amp;gt;&amp;gt; Authentication. In the drop down listbox titled  &amp;quot;Choose an authentication method&amp;quot; select &amp;quot;Use an LDAP Server&amp;quot;. You will get a page similar to this one:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
::: [[Image:auth_ldap_config_screenshot.jpg]]&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, you just have to fill in the values. Let&#039;s go step by step.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
! Field name&lt;br /&gt;
! Value to fill in&lt;br /&gt;
|-&lt;br /&gt;
| ldap_host_url&lt;br /&gt;
| As the IP of your LDAP server is 192.168.1.100, type &amp;quot;&#039;&#039;&#039;ldap://192.168.1.100&#039;&#039;&#039;&amp;quot; (without the quotes).&lt;br /&gt;
|-&lt;br /&gt;
| ldap_version&lt;br /&gt;
| Unless you are using a really old LDAP server, &#039;&#039;&#039;version 3&#039;&#039;&#039; is the one you should choose.&lt;br /&gt;
|-&lt;br /&gt;
| ldap_preventpassindb&lt;br /&gt;
| As you &#039;&#039;&#039;don&#039;t&#039;&#039;&#039; want to store the users&#039;s password in Moodle&#039;s database, choose &#039;&#039;&#039;Yes&#039;&#039;&#039; here.&lt;br /&gt;
|-&lt;br /&gt;
| ldap_bind_dn&lt;br /&gt;
| This is the distinguished name of the bind user defined above. Just type &amp;quot;&#039;&#039;&#039;cn=ldap-user,dc=my,dc=organization,dc=domain&#039;&#039;&#039;&amp;quot; (without the quotes).&lt;br /&gt;
|-&lt;br /&gt;
| ldap_bind_pw&lt;br /&gt;
| This is the bind user password defined above. Type &amp;quot;&#039;&#039;&#039;hardtoguesspassword&#039;&#039;&#039;&amp;quot; (without the quotes).&lt;br /&gt;
|-&lt;br /&gt;
| ldap_user_type&lt;br /&gt;
| Choose: &lt;br /&gt;
* &#039;&#039;&#039;Novel Edirectory&#039;&#039;&#039; if your LDAP server is running Novell&#039;s eDdirectory.&lt;br /&gt;
* &#039;&#039;&#039;posixAccount (rfc2307)&#039;&#039;&#039; if your LDAP server is running a RFC-2307 compatible LDAP server (choose this is your server is running OpenLDAP).&lt;br /&gt;
* &#039;&#039;&#039;posixAccount (rfc2307bis)&#039;&#039;&#039; if your LDAP server is running a RFC-2307bis compatible LDAP server.&lt;br /&gt;
* &#039;&#039;&#039;sambaSamAccount (v.3.0.7)&#039;&#039;&#039; if your LDAP server is running with SAMBA&#039;s 3.x LDAP schema extension and you want to use it.&lt;br /&gt;
* &#039;&#039;&#039;MS ActiveDirectory&#039;&#039;&#039; if your LDAP server is running Microsoft&#039;s Active Directory (MS-AD)&lt;br /&gt;
|-&lt;br /&gt;
| ldap_contexts&lt;br /&gt;
| The DN of the context (container) where all of your Moodle users are found. Type &#039;&#039;&#039;ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039; here.&lt;br /&gt;
|-&lt;br /&gt;
| ldap_search_sub&lt;br /&gt;
| If you have any sub organizational units (subcontexts) hanging from &#039;&#039;&#039;ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039; and you want Moodle to search there too, set this to &#039;&#039;&#039;yes&#039;&#039;&#039;. Otherwise, set this to &#039;&#039;&#039;no&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| ldap_opt_deref&lt;br /&gt;
| Sometimes your LDAP server will tell you that the real value you are searching for is in fact in another part of the LDAP tree (this is called an alias). If you want Moodle to &#039;dereference&#039; the alias and fetch the real value from the original location, set this to &#039;&#039;&#039;yes&#039;&#039;&#039;. If you don&#039;t want Moodle to dereference it, set this to &#039;&#039;&#039;no&#039;&#039;&#039;. If you are using MS-AD, set this to &#039;&#039;&#039;no&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| ldap_user_attribute&lt;br /&gt;
| The attribute used to name/search users in your LDAP tree. This option takes a default value based on the &#039;&#039;ldap_user_type&#039;&#039; value you choosed above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in&amp;lt;/u&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
By the way, it&#039;s usually &#039;&#039;&#039;cn&#039;&#039;&#039; (Novell eDirectory and MS-AD) or &#039;&#039;&#039;uid&#039;&#039;&#039; (RFC-2037, RFC-2037bis and SAMBA 3.x LDAP extension), but if you are using MS-AD you could use &#039;&#039;&#039;sAMAccountName&#039;&#039;&#039; (the pre-Windows 2000 logon account name) if you need too.&lt;br /&gt;
|-&lt;br /&gt;
| ldap_memberattribute&lt;br /&gt;
| The attribute used to list the members of a given group. This option takes a default value based on the &#039;&#039;ldap_user_type&#039;&#039; value you choosed above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By the way, the usual values are &#039;&#039;&#039;member&#039;&#039;&#039; and &#039;&#039;&#039;memberUid&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| ldap_objectclass&lt;br /&gt;
| The type of LDAP object used to search for users. This option takes a default value based on the &#039;&#039;ldap_user_type&#039;&#039; value you choosed above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here are the default values for each of the &#039;&#039;ldap_user_type&#039;&#039; values:&lt;br /&gt;
* &#039;&#039;&#039;User&#039;&#039;&#039; for Novel eDirectory&lt;br /&gt;
* &#039;&#039;&#039;posixAccount&#039;&#039;&#039; for RFC-2037 and RFC-2037bis&lt;br /&gt;
* &#039;&#039;&#039;sambaSamAccount&#039;&#039;&#039; for SAMBA 3.0.x LDAP extension&lt;br /&gt;
* &#039;&#039;&#039;user&#039;&#039;&#039; for MS-AD&lt;br /&gt;
|-&lt;br /&gt;
| Force change password&lt;br /&gt;
| Set this to &#039;&#039;Yes&#039;&#039; if you want to force your users to change their password on the first login into Moodle. Otherwise, set this to &#039;&#039;no&#039;&#039;. Bear in mind the password they are forced to change is the one stored in your LDAP server.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;As you don&#039;t want your users to change their passwords in their first login, leave this set to &#039;&#039;No&#039;&#039;&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Use standard Change Password Page&lt;br /&gt;
|&lt;br /&gt;
* Setting this to &#039;&#039;Yes&#039;&#039; makes Moodle use it&#039;s own standard password change page, everytime users want to change their passwords.&lt;br /&gt;
* Setting this to &#039;&#039;No&#039;&#039; makes Moodle use the the page specified in the field called &amp;quot;Change password URL&amp;quot; (at the bottom of the configuration page).&lt;br /&gt;
&lt;br /&gt;
Bear in mind that changing your LDAP passwords from Moodle might require a LDAPS connection (this is true at least for MS-AD).&lt;br /&gt;
&lt;br /&gt;
Also, code for changing passwords from Moodle for anything but Novell eDirectory is almost not tested, so this may or may not work for other LDAP servers.&lt;br /&gt;
|-&lt;br /&gt;
| ldap_expiration&lt;br /&gt;
| &lt;br /&gt;
* Setting this to &#039;&#039;No&#039;&#039; will make Moodle not to check if the password of the user has expired or not.&lt;br /&gt;
* Setting this to &#039;&#039;LDAP&#039;&#039; will make Moodle check if the LDAP password of the user has expired or not, and warn her a number of days before the password expires.&lt;br /&gt;
&lt;br /&gt;
Current code only deals with Novell eDirectory LDAP server, but there is a patch floating around to make it work with MS-AD too (search in the authentication forum).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;So unless you have Novell eDirectory server (or use the patch), choose &#039;&#039;No&#039;&#039; here.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| ldap_expiration_warning&lt;br /&gt;
| This value sets how many days in advance of password expiration the user is warned that her password is about to expire.&lt;br /&gt;
|-&lt;br /&gt;
| ldap_exprireattr&lt;br /&gt;
| The LDAP user attribute used to check password expiration. This option takes a default value based on the &#039;&#039;ldap_user_type&#039;&#039; value you choosed above. &amp;lt;u&amp;gt;So unless you need something special, you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| ldap_gracelogins&lt;br /&gt;
| This setting is specific to Novell eDirectory. If set to &#039;&#039;Yes&#039;&#039;, enable LDAP gracelogin support. After password has expired the user can login until gracelogin count is 0.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;So unless you have Novell eDirectory server and want to allow gracelogin support, choose &#039;&#039;No&#039;&#039; here.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| ldap_graceattr&lt;br /&gt;
| This setting is currently not used in the code (and is specific to Novell eDirectory). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;So you don&#039;t need to fill this in.&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| ldap_create_context&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| ldap_creators&lt;br /&gt;
| The DN of the group that contains all of your Moodle creators. This is typically a posixGroup with a &amp;quot;memberUid&amp;quot; attribute for each user you want to be a creator.  If your group is called &#039;&#039;creators&#039;&#039;, type &#039;&#039;&#039;cn=creators,ou=moodleusers,dc=my,dc=organization,dc=domain&#039;&#039;&#039; here.  Each memberUid attribute contains the CN of a user who is authorized to be a creator.  Do not use the user&#039;s full DN (e.g.,  not &#039;&#039;&#039;memberUid: cn=JoeTeacher,ou=moodleusers,dc-my,dc=organizations,dc=domain&#039;&#039;&#039;, but rather &#039;&#039;&#039;memberUid: JoeTeacher&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
In eDirectory, the objectClass for a group is (by default) not &#039;&#039;&#039;posixGroup&#039;&#039;&#039; but &#039;&#039;&#039;groupOfNames,&#039;&#039;&#039; whose member attribute is &#039;&#039;&#039;member,&#039;&#039;&#039; not &#039;&#039;&#039;memberUid,&#039;&#039;&#039; and whose value is the full DN of the user in question.  Although you can probably modify Moodle&#039;s code to use this field, a better solution is just to add a new &#039;&#039;&#039;objectClass&#039;&#039;&#039; attribute of &#039;&#039;&#039;posixGroup&#039;&#039;&#039; to your creators group and put the CNs for each creator in a &#039;&#039;&#039;memberUid&#039;&#039;&#039; attribute.&lt;br /&gt;
&lt;br /&gt;
In MS Active Directory, you will need to create a security group for your creators to be part of and then add them all. If your ldap context above is &#039;ou=staff,dc=my,dc=org&#039; then your group should then be &#039;cn=creators,ou=staff,dc=my,dc=org&#039;. If some of the users are from other contexts and have been added to the same security group, you&#039;ll have to add these as separate contexts after the first one using the same format.&lt;br /&gt;
|-&lt;br /&gt;
| First name&lt;br /&gt;
| The name of the attribute that holds the first name of your users in your LDAP server. This is usually &#039;&#039;&#039;givenName&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Surname&lt;br /&gt;
| The name of the attribute that holds the surname of your users in your LDAP server. This is usually &#039;&#039;&#039;sn&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Email address&lt;br /&gt;
| The name of the attribute that holds the email address of your users in your LDAP server. This is usually &#039;&#039;&#039;mail&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Phone 1&lt;br /&gt;
| The name of the attribute that holds the telephone number of your users in your LDAP server. This is usually &#039;&#039;&#039;telephoneNumber&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Phone 2&lt;br /&gt;
|  The name of the attribute that holds an additional telephone number of your users in your LDAP server. This can be &#039;&#039;&#039;homePhone&#039;&#039;&#039;, &#039;&#039;&#039;mobile&#039;&#039;&#039;, &#039;&#039;&#039;pager&#039;&#039;&#039;, &#039;&#039;&#039;facsimileTelephoneNumber&#039;&#039;&#039; or even others.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Department&lt;br /&gt;
| The name of the attribute that holds the department name of your users in your LDAP server. This is usully &#039;&#039;&#039;departmentNumber&#039;&#039;&#039; (for posixAccount and maybe eDirectory) or &#039;&#039;&#039;department&#039;&#039;&#039; (for MS-AD).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Address&lt;br /&gt;
| The name of the attribute that holds the street address of your users in your LDAP server. This is usully &#039;&#039;&#039;streetAddress&#039;&#039;&#039; or &#039;&#039;&#039;street&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| City/town&lt;br /&gt;
| The name of the attribute that holds the city/town of your users in your LDAP server. This is usully &#039;&#039;&#039;l&#039;&#039;&#039; (lowercase L) or &#039;&#039;&#039;localityName&#039;&#039;&#039; (not valid in MS-AD).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| Country&lt;br /&gt;
| The name of the attribute that holds the couuntry of your users in your LDAP server. This is usully &#039;&#039;&#039;c&#039;&#039;&#039; or &#039;&#039;&#039;countryName&#039;&#039;&#039; (not valid in MS-AD).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Description&lt;br /&gt;
| &#039;&#039;&#039;description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| ID Number&lt;br /&gt;
| &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Language&lt;br /&gt;
| &#039;&#039;&#039;preferredLanguage&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;This setting is optional&amp;lt;/u&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Instructions&lt;br /&gt;
| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The rest of the fields are common to all authentication methods and will not be discussed here.&lt;br /&gt;
&lt;br /&gt;
==Advanced Scenarios==&lt;br /&gt;
&lt;br /&gt;
===Using multiple LDAP Servers===&lt;br /&gt;
Entering more than one name in the ldap_host_url field can provide some sort of resilience to your system. Simply use the syntax :&lt;br /&gt;
ldap://my.first.server ; ldap://my.second.server ; ...&lt;br /&gt;
&lt;br /&gt;
Of course, this will only work if all the servers share the same directory information, using a replication or synchronization mecanism once introduced in eDirectory and now generalized to the main LDAP-compatible directories.&lt;br /&gt;
&lt;br /&gt;
There is one drawback in Moodle 1.5 - 1.6 implementation of LDAP authentication : the auth_ldap_connect() function processes the servers sequentially, not in a round robin mode. Thus, if the primary server fails, you will have to wait for the connection to time out before switching to the following one.&lt;br /&gt;
&lt;br /&gt;
===Using multiple user locations (contexts) in your LDAP tree===&lt;br /&gt;
There is no need to use multiple user locations if your directory tree is flat, i.e. if all user accounts reside in a &#039;&#039;&#039;ou=people,dc=my,dc=organization,dc=domain&#039;&#039;&#039; or &#039;&#039;&#039;ou=people,o=myorg&#039;&#039;&#039; container. &lt;br /&gt;
&lt;br /&gt;
At the opposite, if you use the ACL mecanism to delegate user management, there are chances that your users will be stored in containers like &#039;&#039;&#039;ou=students,ou=dept1,o=myorg&#039;&#039;&#039; and &#039;&#039;&#039;ou=students,ou=dept2,o=myorg&#039;&#039;&#039; ...&lt;br /&gt;
&lt;br /&gt;
Then there is an alternative :&lt;br /&gt;
* Look at the &#039;&#039;&#039;o=myorg&#039;&#039;&#039; level with the ldap_search_sub attribute set to &#039;&#039;&#039;yes&#039;&#039;&#039;.&lt;br /&gt;
* Set the ldap_context to &#039;&#039;&#039;ou=students,ou=dept1,o=myorg ; ou=students,ou=dept2,o=myorg&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Choosing between these two solutions supposes some sort of benchmarking, as the result depends heavily on the structure of your directory tree &#039;&#039;&#039;and&#039;&#039;&#039; on your LDAP software indexing capabilities. Simply note that there is a probability in such deep trees that two users share the same &#039;&#039;common name&#039;&#039; (cn), while having different &#039;&#039;distinguished names&#039;&#039;. Then only the second solution will have a deterministic result (returning allways the same user).&lt;br /&gt;
&lt;br /&gt;
===Using LDAPS (LDAP + SSL)===&lt;br /&gt;
====MS Active Directory + SSL ====&lt;br /&gt;
&lt;br /&gt;
If the Certificate Authority is not installed you&#039;ll have to install it first as follows:&lt;br /&gt;
# Click &#039;&#039;&#039;Start&#039;&#039;&#039; -&amp;gt; &#039;&#039;&#039;Control Panel&#039;&#039;&#039; -&amp;gt; &#039;&#039;&#039;Add or Remove programs.&#039;&#039;&#039;&lt;br /&gt;
# Click &#039;&#039;&#039;Add/Remove Windows Components&#039;&#039;&#039; and select &#039;&#039;&#039;Certificate Services.&#039;&#039;&#039;&lt;br /&gt;
# Follow the procedure provided to install the &#039;&#039;&#039;Certificate Authority&#039;&#039;&#039;. Enterprise level is a good choice.&lt;br /&gt;
&lt;br /&gt;
Verify that SSL has been enabled on the server by installing suptools.msi from Windows installation cd&#039;s \Support\tools directory. After support tools installation:&lt;br /&gt;
# Select &#039;&#039;&#039;Start&#039;&#039;&#039; -&amp;gt; &#039;&#039;&#039;Run&#039;&#039;&#039;, write &#039;&#039;&#039;ldp&#039;&#039;&#039; in the Open field.&lt;br /&gt;
# From the ldp window select &#039;&#039;&#039;Connection&#039;&#039;&#039; -&amp;gt; &#039;&#039;&#039;Connect&#039;&#039;&#039; and supply valid hostname and port number &#039;&#039;&#039;636&#039;&#039;&#039;. Also select the SSL check box.&lt;br /&gt;
&lt;br /&gt;
If successful, you should get information about the connection.&lt;br /&gt;
&lt;br /&gt;
Next step is to tell PHP&#039;s OpenLDAP extension to disable SSL certificate checking. On Windows servers you&#039;re most likely using pre-compiled PHP version, where you must create a path &#039;&#039;C:\OpenLDAP\sysconf&#039;&#039;. In this path create a file called &amp;quot;ldap.conf&amp;quot; with content:&lt;br /&gt;
&lt;br /&gt;
 TLS_REQCERT never.&lt;br /&gt;
&lt;br /&gt;
Now you should be able to use &#039;&#039;&#039;ldaps://&#039;&#039;&#039; when connecting to MS-AD.&lt;br /&gt;
&lt;br /&gt;
==Appendices==&lt;br /&gt;
&lt;br /&gt;
===Child Domains and the Global Catalog in MS Active Directory===&lt;br /&gt;
&lt;br /&gt;
Moodle currently only has limited support for multiple domain controllers; specifically it expects each of the LDAP servers listed to contain identical sets of information. If you have users in multiple domains this presents an issue. One solution when working with MS-AD is to use the Global Catalog. The Global Catalog is designed to be a read-only, partial representation of an entire MS-AD forest, designed for searching the entire directory when the domain of the required object is not known.&lt;br /&gt;
&lt;br /&gt;
For example your organisation has a main domain example.org, staff and students are contained in two child domains staff.example.org and students.example.org. The 3 domains (example.org, staff.example.org and students.example.org) each have a domain controller (dc01, dc02 and dc03 respectively.) Each domain controller contains a full, writable, representation of only the objects that belong to its domain. However, assuming that the Global Catalog has been enabled (see below) on one of the domain controllers (for example dc01) a query to the Global Catalog would reveal matching objects from all three domains. The Global Catalog is automatically maintained through replication across the active directory forest, it can also be enabled on multiple servers (if, for example, you need redundancy / load balancing.)&lt;br /&gt;
&lt;br /&gt;
To make use of this in Moodle to allow logins from multiple domains is simple. The Global Catalog runs on port 3268 as opposed to 389 for standard LDAP queries. As a result, still assuming the Global Catalog is running on dc01, the &#039;&#039;&#039;&#039;ldap_host_url&#039;&#039;&#039;&#039; would be &#039;&#039;ldap://dc01.example.org:3268&#039;&#039;. The rest of the settings are the same as for other MS-AS Auth setups.&lt;br /&gt;
&lt;br /&gt;
You should use the &#039;&#039;&#039;&#039;ldap_contexts&#039;&#039;&#039;&#039; setting to indicate the locations of individuals you wish to grant access. To extend the example above a little: In the example.org domain users are all in the&#039;&#039; &#039;Users&#039; &#039;&#039;OU, in the staff.example.org domain users are in two OUs at the root of the domain,&#039;&#039; &#039;Support Staff&#039; &#039;&#039;and&#039;&#039; &#039;Teaching Staff&#039; &#039;&#039;, and in the students.example.org domain students are in an OU indicating the year that they enrolled, all of which are under the&#039;&#039; &#039;Students&#039; &#039;&#039;OU. As a result our &#039;&#039;&#039;&#039;ldap_contexts&#039;&#039;&#039;&#039; setting may look a little like this:&#039;&#039; &#039;OU=Users,DC=example,DC=org; OU=Support Staff,DC=staff,DC=example,DC=org; OU=Teaching Staff,DC=staff,DC=example,DC=org; OU=Students,DC=students,DC=example,DC=org&#039;&#039;.&#039; The &#039;&#039;&#039;&#039;ldap_search_sub&#039;&#039;&#039;&#039; option should be set to&#039;&#039; &#039;Yes&#039; &#039;&#039;to allow moodle to search within the child OUs.&lt;br /&gt;
&lt;br /&gt;
Its worth noting that the Global Catalog only contains a partial representation of the attributes of each object, as defined in the Partial Attribute Set supplied by Microsoft. However common information likely to be of use to a general Moodle installation (Forename, Surname, Email Address, sAMAccountName etc) is included in the set. For specific needs the schema can be altered to remove or add various attributes.&lt;br /&gt;
&lt;br /&gt;
In most cases the Global Catalog is read-only, update queries must be made over the standard LDAP ports to the domain controller that holds the object in question (in our example, updating a student&#039;s details would require an LDAP query to the students.example.org domain controller - dc03, it would not be possible to update details by querying the Global Catalog.) The exception to this would be in an environment where there is only a single domain in the active directory forest; in this case the Global Catalog holds a writable full set of attributes for each object in the domain. However, for the purposes of Moodle authorisation, there would be no need to use the Global Catalog in this case.&lt;br /&gt;
&lt;br /&gt;
====Enabling the Global Catalog====&lt;br /&gt;
&lt;br /&gt;
The Global Catalog is available on Windows 2000 and Windows 2003 Active Directory servers. To enable, open the ‘Active Directory Sites and Services’ MMC (Microsoft Management Console) snap-in. Extend ‘Sites’ and then the name of the Site containing the active directory forest you wish to use. Expand the server you wish to enable the Global Catalog on, right click ‘NTDS settings’ and select the ‘Properties’ tab. To enable, simply click the ‘Global Catalog’ checkbox. Under a Windows 2000 server it is necessary to restart the server (although it won’t prompt you to); under Windows 2003 server it is not necessary to restart the server. In either case you will generally have to wait for the AD forest to replicate before the Global Catalog offers a representation of the entire AD forest. Changes made in Active Directory will also be subject to a short delay due to the latency involved with replication. If your AD servers are firewalled port 3268 will need to be opened for Global Catalog servers.&lt;br /&gt;
If your organisation uses Microsoft Exchange then it its highly likely that at least one Domain Controller will already have Global Catalog enabled – Exchange 2000 and 2003 rely on the Global Catalog for address information, users also access the Global Catalog when using the GAL (Global Address List)&lt;br /&gt;
&lt;br /&gt;
====ldap auth_user_create() only suports Novell====&lt;br /&gt;
&lt;br /&gt;
After configuring user authentification with ldap I realized ldap only support edir (Novell) when combining ldap an email user confirmation. For example in my case (I use openldap) I have the following error after filling the user form:&lt;br /&gt;
&lt;br /&gt;
auth: ldap auth_user_create() does not support selected usertype:&amp;quot;rfc2307&amp;quot; (..yet)&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[http://moodle.org/mod/forum/view.php?id=42 Using Moodle: User authentication] forum&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=32168 PHP LDAP module does not seem to be present] forum discussion&lt;br /&gt;
* [[LDAP enrolment]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Administrator]]&lt;br /&gt;
[[Category:Authentication]]&lt;/div&gt;</summary>
		<author><name>Acacha</name></author>
	</entry>
</feed>