Configure LDAP Searches & Mappings
Using Directory Utility, you can edit the mappings, search bases, and search scopes that specify how a Mac finds specific data items in an LDAP directory. Each LDAP directory configuration specifies how a Mac accesses data in an LDAPv3 or LDAPv2 directory. You can edit these settings separately for each LDAP directory configuration listed in Directory Utility.
You can edit the following:
The mapping of each macOS record type to LDAP object classes
The mapping of macOS data types, or attributes, to LDAP attributes for each record type
The LDAP search base and search scope that determine where a Mac looks for a macOS record type in an LDAP directory
When mapping macOS user attributes to a read/write LDAP directory domain, the LDAP attribute mapped to RealName must not be the same as the first attribute in a list of LDAP attributes mapped to RecordName.
For example, the cn attribute must not be the first attribute mapped to RecordName if cn is also mapped to RealName.
If the LDAP attribute mapped to RealName is the same as the first attribute mapped to RecordName, problems occur when you try to edit the full (long) name or the first short name in macOS Server or Directory Editor.
Note: If you clicked the Read from Server button to view all record types and attributes from the bound server, record types or attributes not present in the local directory domain, such as AutoServerSetup or Neighborhoods, are marked red in the Record Types and Attributes window.
Click Services.
Click the lock icon.
Enter an administrator’s user name and password, then click Modify Configuration (or use Touch ID).
Select LDAPv3, then click the Edit button (looks like a pencil).
If the list of server configurations is hidden, click Show Options.
Select a server configuration, then click Edit.
Click Search & Mappings.
Select the mappings you want to use as a starting point; otherwise, choose Custom to begin with no predefined mappings.
If you choose an LDAP mapping template, a search base suffix that you can change appears, or you can accept the default search base suffix by clicking OK.
Click the “Access this LDAPv3 server using” pop-up menu and choose a mapping template to use its mappings as a starting point.
Add record types and change their search bases as needed.
Add record types: Click the Add button below the Record Types and Attributes list. In the dialog that appears, select Record Types, select the record types in the list, then click OK.
Change the search base and search scope of a record type: Select it in the Record Types and Attributes list, then edit the “Search base” field. Select “all subtrees” to set the search scope to include the LDAP directory’s hierarchy from the search base down, or select “first level only” to set the search scope to include only the search base and one level below it in the LDAP directory’s hierarchy.
Remove a record type: Select it in the Record Types and Attributes list, then click Delete.
Add a mapping for a record type: Select the record type in the Record Types and Attributes list, click the Add button below “Map to_items in list,” then enter the name of an object class from the LDAP directory.
Add another LDAP object class: Press Return, then enter the name of the object class and specify whether to use the listed LDAP object classes by using the pop-up menu above the list.
Change a mapping for a record type: Select the record type in the Record Types and Attributes list, double-click the LDAP object class you want to change in the “Map to __ items in list,” then edit it. Specify whether to use the listed LDAP object classes by using the pop-up menu above the list.
Remove a mapping for a record type: Select the record type in the Record Types and Attributes list, select the LDAP object class you want to remove from the “Map to __ items in list,” then click Delete (below “Map to __ items in list”).
Add attributes and change their mappings as needed.
Add attributes to a record type: Select the record type in the Record Types and Attributes list, then click the Add button (below the Record Types and Attributes list). In the dialog that appears, select Attribute Types, select an attribute type, then click OK.
Add a mapping for an attribute: Select the attribute in the Record Types and Attributes list, click the Add button (below “Map to __ items in list”), then enter the name of an attribute from the LDAP directory. To add another LDAP attribute, press Return, then enter the name of the attribute.
Change a mapping for an attribute: Select the attribute in the Record Types and Attributes list, double-click the item you want to change in the “Map to __ items in list,” then edit the item name.
Remove a mapping for an attribute: Select the attribute in the Record Types and Attributes list, select the item you want to remove from the “Map to __ items in list,” then click Delete (below “Map to __ items in list”).
Change the order of attributes that appear in the list on the right: Drag the attributes up or down in the list.
Save your mappings as a template or store them to a server.
To save your mappings as a template, click Save Template.
Templates saved in the default location are listed in the pop-up menus of LDAP mapping templates the next time you open Directory Utility. The default location for saved templates is in your home folder at this path:
~/Library/Application Support/Directory Access/LDAPv3/Templates/
To store the mappings in the LDAP directory so it can supply them automatically to its clients, click Write to Server, then enter a search base to store the mappings, a distinguished name of an administrator or other user with write permission for the search base (for example, uid=diradmin,cn=users,dc=ods,dc=example,dc=com), and a password.
If you are writing mappings to an Open Directory LDAP server, the correct search base is cn=config,suffix (where suffix is the server’s search base suffix, such as dc=ods,dc=example,dc=com).
The LDAP directory supplies its mappings to Mac clients whose custom search policy includes a connection that’s configured to get mappings from the LDAP server.
The LDAP directory also supplies its mappings to all macOS clients that have an automatic search policy. For more information, see Configure LDAP directory access and Advanced search policy settings.