LDAP
Authenticate people against your LDAP directory and map LDAP groups to Metabase groups.
Metabase supports authentication with Lightweight Directory Access Protocol (LDAP).
Required LDAP attributes
You need to set up your LDAP directory with these attributes:
- email (defaulting to the
mailattribute) - first name (defaulting to the
givennameattribute) - last name (defaulting to the
snattribute).
If your LDAP setup uses other attributes for these, you can change them in the Attributes section of the LDAP settings page. The section becomes available after you save your server settings.

Your LDAP directory must have the email field populated for each entry that will become a Metabase user, otherwise Metabase won’t be able to create the account, nor will that person be able to log in. If either name field is missing, Metabase will use a default of “Unknown,” and the person can change their name in their account settings.
On self-hosted Metabases, you can also set these attribute names with the environment variables MB_LDAP_ATTRIBUTE_EMAIL, MB_LDAP_ATTRIBUTE_FIRSTNAME, and MB_LDAP_ATTRIBUTE_LASTNAME, or, on Pro and Enterprise plans, in the config file.
Enabling LDAP authentication
To enable LDAP authentication, go to Admin > Settings > Authentication > LDAP and click Set up. Fill out the form, then click Save and enable.
Until you save your server settings, the Attributes and Group mapping sections stay locked. You can edit User provisioning before you save.
Server settings
- LDAP host (required): Your server hostname. For example,
ldap.yourdomain.org. - LDAP port: The server port, usually 389, or 636 if you use SSL.
- LDAP security: None, SSL, or StartTLS.
- Username or DN: The distinguished name to bind as, if any. Metabase uses this name to look up information about other users.
- Password: The password to bind with for the lookup user.
Then save your changes. Metabase will automatically pull the required attributes from your LDAP directory.
On self-hosted Metabases, you can also set these server settings with the environment variables MB_LDAP_HOST, MB_LDAP_PORT, MB_LDAP_SECURITY, MB_LDAP_BIND_DN, and MB_LDAP_PASSWORD.
User provisioning
User provisioning is enabled by default. When someone logs in via LDAP, Metabase creates an account for them if they don’t have one, and reactivates their account if it is deactivated. The switch saves on its own, so you don’t need to click Save changes after you change it.
If you disable user provisioning, users without accounts or with deactivated accounts will not be able to log in.
On self-hosted Pro and Enterprise plans, you can also turn user provisioning on or off with the MB_LDAP_USER_PROVISIONING_ENABLED environment variable or in the config file.
User schema
The User schema section on this same page is where you can adjust settings related to where and how Metabase connects to your LDAP server to authenticate users.
User search base
User search base is required. Enter the distinguished name (DN) of the entry in your LDAP server that Metabase should use as the starting point when searching for users.
For example, let’s say you’re configuring LDAP for your company, WidgetCo, where your base DN is dc=widgetco,dc=com. If entries for employees are all stored within an organizational unit in your LDAP server named People, you’ll want to supply the user search base field with the DN ou=People,dc=widgetco,dc=com. This tells Metabase to begin searching for matching entries at that location within the LDAP server.
On self-hosted Metabases, you can also set the user search base with the MB_LDAP_USER_BASE environment variable or, on Pro and Enterprise plans, in the config file.
User filter
You’ll see the following grayed-out default value in the User filter field:
(&(objectClass=inetOrgPerson)(|(uid={login})(mail={login})))
When a person logs into Metabase, this command confirms that the login they supplied matches either a UID or email field in your LDAP server, and that the matching entry has an objectClass of inetOrgPerson.
This default command will work for most LDAP servers, since inetOrgPerson is a widely-adopted objectClass. But if your company for example uses a different objectClass to categorize employees, this field is where you can set a different command for how Metabase finds and authenticates an LDAP entry upon a person logging in.
On self-hosted Metabases, you can also set the user filter with the MB_LDAP_USER_FILTER environment variable or, on Pro and Enterprise plans, in the config file.
Group mapping
Instead of manually assigning people to groups, use group mappings to assign them based on their LDAP groups.
To map an LDAP group to a Metabase group:
- In the Group mapping section, turn on the toggle.
- Next to Manual group mappings, click New.
- Enter the distinguished name for the LDAP group, such as
cn=Accounting,ou=Groups,dc=example,dc=org. - From Pick Metabase group, select the Metabase groups that people in this LDAP group should be added to.
- Click Add mapping.
- Repeat steps 2 to 5 for each group you want to map.
Metabase saves each mapping as soon as you add, edit, or remove it. To edit a mapping, hover over it and click the pencil icon.
Some LDAP directories list each person’s groups on their own entry. If yours does, leave Group search base empty. Otherwise, enter the DN where your group entries live.
On self-hosted Metabases, you can also set the group mapping toggle, the mappings themselves, and the group search base with the environment variables MB_LDAP_GROUP_SYNC, MB_LDAP_GROUP_MAPPINGS, and MB_LDAP_GROUP_BASE.

Some things to keep in mind regarding group mapping:
- Metabase syncs membership of the Administrators group like any other group.
- Updates to a person’s group membership based on LDAP mappings are not instantaneous; the changes will take effect only after people log back in.
- People are only ever added to or removed from mapped groups. The sync has no effect on Metabase groups that don’t have an LDAP mapping.
Remove a group mapping
To remove a mapping, hover over it and click the trash icon. Metabase asks what should happen to the Metabase group:
- Nothing, just remove the mapping
- Also remove all members from this group. Members keep their Metabase accounts.
- Also delete the group
Then click Remove mapping. Removing members or deleting a group takes effect immediately and can’t be undone.
If the mapping points to a built-in group such as Administrators, Metabase doesn’t offer these options. It removes the mapping without changing the group or its members.
Also delete the group isn’t available when another mapping uses the same Metabase group.
Group membership filter
LDAP advanced features are only available on Pro and Enterprise plans (both self-hosted and on Metabase Cloud).
If your directory doesn’t list each person’s groups on their own entry, Metabase looks up membership on the group entries instead. Group membership filter sets that lookup filter. Metabase replaces the placeholders {dn} and {uid} with the person’s distinguished name and UID.
On self-hosted Metabases, you can also set the filter with the MB_LDAP_GROUP_MEMBERSHIP_FILTER environment variable or, on Pro and Enterprise plans, in the config file.
Syncing user attributes with LDAP
LDAP advanced features are only available on Pro and Enterprise plans (both self-hosted and on Metabase Cloud).
Metabase always reads people’s email, first name, and last name from your LDAP directory. If you turn on group mapping, Metabase also reads their groups. You can also sync other user attributes, such as roles, from your LDAP directory.
To choose which user attributes to sync, list them, separated by commas, in the MB_LDAP_SYNC_USER_ATTRIBUTES_ALLOWLIST environment variable or as ldap-sync-user-attributes-allowlist in the config file. By default, the list is empty, so Metabase doesn’t sync any user attributes. To turn off user attribute syncing entirely, set MB_LDAP_SYNC_USER_ATTRIBUTES to false.
Troubleshooting login issues
Further reading
Read docs for other versions of Metabase.