<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/405/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Questions</id>
	<title>MoodleDocs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/405/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Questions"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/Special:Contributions/Questions"/>
	<updated>2026-07-16T15:10:47Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=External_database_authentication&amp;diff=114812</id>
		<title>External database authentication</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=External_database_authentication&amp;diff=114812"/>
		<updated>2014-09-12T18:15:41Z</updated>

		<summary type="html">&lt;p&gt;Questions: /* See also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Authentication}}&lt;br /&gt;
Location: &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Plugins &amp;gt; Authentication &amp;gt; External database&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This method uses an external database table to check whether a given username and password is valid. If the user does not currently exist in Moodle a new account will be created and their information copied from the external database. &lt;br /&gt;
&lt;br /&gt;
== Field mappings ==&lt;br /&gt;
&lt;br /&gt;
This is done by mapping fields at the bottom of the database authentication page. Each data field in the user profile has a text field next to it. Enter the name of the column in the external database that maps to the profile data field.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Update Local&#039;&#039;&#039; - Specifies that the external data will be entered into the local field in question&lt;br /&gt;
* On Creation - specifies that this will only happen on the original login when the account is created for the first time.&lt;br /&gt;
* On Every Login - specifies that changes in the external data will be updated on the local Moodle field in question the next time the user logs in again.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Update External&#039;&#039;&#039; - Specifies just the opposite, meaning changes in the local Moodle field in question will update the corresponding field in the external database&lt;br /&gt;
* Never - Specifies this is disabled&lt;br /&gt;
* On Update - Enables this to happen if a change is made locally (additional configuration is probably required)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Lock Value&#039;&#039;&#039; - Only determines whether the local user can make a change in the Moodle field and does not affect the two settings above.&lt;br /&gt;
* Unlocked - A user can make changes locally in the Moodle field (assumably even if it contradicts the external database the next login would change it again if Update Local is set&lt;br /&gt;
* Locked - A user can never make changes&lt;br /&gt;
* Unlocked if empty - A user can only make changes if the field is not populated already from the external database (this would seem to indicate a user could only enter something into this field once and could not change it after saving)&lt;br /&gt;
&lt;br /&gt;
== Automatic Synchronisation ==&lt;br /&gt;
&lt;br /&gt;
The above method adds new users only when they log in. If you want user accounts to be created in Moodle independent of actual logins, the db authentication plugin offers a script you can run regularly via &#039;cron&#039;. A typical cron entry will be as follows...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0 * * * *    /usr/bin/php /path/to/moodle/auth/db/cli/sync_users.php &amp;gt;dev/null&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This runs every hour (adjust as required). It reads the entire table updating and creating local Moodle users. &lt;br /&gt;
&lt;br /&gt;
==Additional Notes==&lt;br /&gt;
* Some of the things that apply to [[Upload users]] apply to the External database&lt;br /&gt;
** Set password to &amp;quot;changeme&amp;quot; to force password reset&lt;br /&gt;
*** If you do this, it is &#039;&#039;&#039;critical&#039;&#039;&#039; that you provide a URL to change the password!&lt;br /&gt;
* Not all of the fields in the [[Upload users]] are available for the External Database authentication. The only available fields are the fields listed in the data mapping section of the admin page for the External Database connection.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=45444 Special and characters con tilde (accute accent) when connected to external database] forum discussion&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=75519 HELP!--User Authentication problem] forum discussion&lt;br /&gt;
*[[External database enrolment]]&lt;br /&gt;
*change password in external DB authentication plugin  [https://moodle.org/mod/forum/discuss.php?d=269311#p1162046] &lt;br /&gt;
&lt;br /&gt;
[[de:Externe Datenbank]]&lt;br /&gt;
[[fr:Utiliser une base de données externe]]&lt;br /&gt;
[[ja:外部データベース認証]]&lt;br /&gt;
[[es:Autenticación con BasedeDatos externa]]&lt;/div&gt;</summary>
		<author><name>Questions</name></author>
	</entry>
</feed>