Integrating Linux and Active Directory


Table of Contents

Requirements

Please note the following requirements when joining to DIT’s Active Directory service.

  1. Protocols to be supported:
    1. LDAPS with support for TLS 1.2 or higher.
    2. SMB 2.0 or higher (SMB 1.0 deprecated and known security vulnerability).
    3. Support for AES Encryption (RC4 known vulnerable encryption).
  2. Naming Convention
    1. Computer names may not be longer than 15 characters (NetBIOS limitation).
    2. The character count limit does not include the domain e.g. umd.edu or ad.umd.edu.
    3. Objects in AD must adhere to DIT’s naming convention. See this PDF.

Gotchas

  1. Numeric UID and primary GID values for users are different when bound to AD than other DIT-managed Linux hosts.
  2. By default, each user gets the shell defined in sssd.conf by the default_shell variable.
  3. Active Directory supports dynamic DNS for hosts bound to it. However, this only works if your host is a member of the ad.umd.edu network domain e.g. myhost.ad.umd.edu. Hosts within the umd.edu domain e.g. myhost.umd.edu will need a separate DNS request submitted.

Requesting Access to AD

General information about DIT’s Active Directory service can be found here in ServiceNow:
https://itsupport.umd.edu/itsupport?id=kb_article_view&sysparm_article=KB0012415

Before you can join a host to AD, you must have an organizational unit (OU) assigned to your department and be granted the appropriate permissions to that OU.

Need an OU Created?

If you do not already have an OU assigned to you, please reach out to the AD team to discuss your use case. The AD team can be contacted at UMD-AD@umd.edu.

Once you have met with the AD team, you can fill out and submit the “OU (Organizational Unit) Administrator Access” request form:
https://itsupport.umd.edu/itsupport?id=sc_cat_item&sys_id=24cbdc866fb83e405cdc1cccbb3ee4f7

Be sure to read and understand all reference material linked in the above form:

  1. Acceptable Use of Data Guidelines for the campus Active Directory
  2. University of Maryland Active Directory Policies
  3. UMD Naming Convention for Active Directory
  4. Administrative Access to Active Directory Resources

Once approved, the AD team will create your OU and delegate administrative access to it as needed.

Already Have an OU?

If you already have an OU assigned to your unit, all administrators with the appropriate permissions can join hosts to the domain.

Use the “OU (Organizational Unit) Administrator Access” form above in the ”Need an OU Created?” section to request access for other administrators within your unit if needed. Again, be sure all administrators read and understand the reference material linked in the request form.

Join a Host to the Active Directory

Red Hat and Ubuntu provide general instructions on joining hosts to Active Directory. For more in-depth information, please see the links below:

The basics instructions have been boiled down below.

Before you start, see this document and confirm the listed ports on the AD server are accessible to your host.

With access confirmed, you may join hosts to the domain:

  1. Configure the host to use the AD servers (ad.umd.edu) for time synchronization.
    RHEL8/9: Edit /etc/chrony.conf and replace the default Red Hat server e.g. 2.rhel.pool.ntp.org: the internet cluster of ntp servers listed with ad.umd.edu:
    pool ad.umd.edu iburst

    Then restart chronyd:
    systemctl restart chronyd

    Ubuntu 24.04/22.04: Update /etc/systemd/timesyncd.conf and add the following line:
    NTP=ad.umd.edu

    Restart systemd-timesyncd:
    systemctl restart systemd-timesyncd
  2. RHEL8/9 only - Add AD-SUPPORT cryptographic policy:
    update-crypto-policies --set DEFAULT:AD-SUPPORT

    And reboot:
    systemctl reboot
  3. Install the required packages:
    RHEL9/8:
    yum install samba-common-tools realmd oddjob oddjob-mkhomedir sssd adcli krb5-workstation

    Ubuntu 24.04:
    sudo apt install sssd-ad sssd-tools realmd adcli krb5-user
  4. Confirm the AD.UMD.EDU realm can be discovered:
    realm discover AD.UMD.EDU

    Output should look something like this:
    # realm discover AD.UMD.EDU
    AD.UMD.EDU
      type: kerberos
      realm-name: AD.UMD.EDU
      domain-name: AD.UMD.EDU
      configured: no
      server-software: active-directory
      client-software: sssd
      required-package: oddjob
      required-package: oddjob-mkhomedir
      required-package: sssd
      required-package: adcli
      required-package: samba-common-tools
    ad.umd.edu
      type: kerberos
      realm-name: AD.UMD.EDU
      domain-name: ad.umd.edu
      configured: no
  5. Join the host to the domain:
    realm -v join --user=<DIR_ID>.admin --computer-ou="OU=<YOUR_OU>,OU=Departments,OU=UMD" AD.UMD.EDU

    There will be quite a lot of output, but if successful, you should see the following as the last line:
    Successfully enrolled machine in realm
  6. Ubuntu only: Enable mkhomedir PAM profile so home directories will be created automatically:
    sudo pam-auth-update --enable mkhomedir
    NOTE: This is enabled by default on RHEL.
  7. Customize the sssd config to increase responsiveness in our environment. Add the following lines under the “[domain/AD.UMD.EDU]” section of /etc/sssd/sssd.conf:
    # Increase process timeouts to reduce timeout failures.
    timeout = 300
    # Do not return group members for group lookups. 
    ignore_group_members = true
  8. Restart SSSD:
    systemctl restart sssd
  9. Done!

Once your host is joined to the domain, the following command should now return a value for any AD user account:
getent passwd <DIR_ID>@AD.UMD.EDU

For example:
$ getent passwd cbettenh@AD.UMD.EDU
cbettenh@AD.UMD.EDU:*:866475304:1491000513:cbettenh:/home/cbettenh@AD.UMD.EDU:/bin/bash

Similarly , run "realm list" to list all of the configured domains. You should see output similar to that of "realm discover AD.UMD.EDU" above for the AD.UMD.EDU realm indicating the realm is now configured on this host. Also, the value for the “configured” key in the output should now be “kerberos-member”.
[root@itusunix0001 sssd]# realm list
AD.UMD.EDU
  type: kerberos
  realm-name: AD.UMD.EDU
  domain-name: ad.umd.edu
  configured: kerberos-member <--- HERE
  [...]

You should also be able to SSH into the host using your AD account credentials:
ssh <DIR_ID>@AD.UMD.EDU@<FQDN>

where <DIR_ID> is your Directory ID, and <FQDN> is the fully-qualified domain name of the host joined to the AD. For example:
cbettenh@laptop ~ % ssh cbettenh@AD.UMD.EDU@itusunix0001.ad.umd.edu
cbettenh@AD.UMD.EDU@itusunix0001.ad.umd.edu's password:
[...]
Last login: Mon Jun  9 10:39:39 2025 from 10.206.37.171
[cbettenh@AD.UMD.EDU@itusunix0001 ~]$

If that all checks out, your host is now confirmed to be bound to DIT’s Active Directory!

Next, please see the “Restricting Access by User or Group” section below!

NOTE: By default, hosts bound to AD will allow any person with an AD account (aka everyone at the university) to log into the host! You must now restrict access. See the “Restricting Access by User or Group” section below to implement access controls.

NOTE: DIT’s Active Directory does not populate the Unix attributes (uidNumber, gidNumber, loginShell, unixHomeDirectory, etc) on user accounts. As a result, ID mapping must be used (ldap_id_mapping = True) on AD clients. For more information on ID mapping, see the “ID Mapping” section on the sssd-ad manual page (man sssd-ad).As a result, UIDs and GIDs created via ID mapping will not match UIDs and GIDs in LDAP or on other DIT-managed Linux hosts.

Restricting Access by User or Group

Out of the box, a host newly jointed to AD will allow access to any AD user. In most cases, this is not the desired state. SSSD allows you to restrict access to a host to specific users or members of a group. See the sections below for instructions.

Restricting Access by User

If you’d like to restrict access to a host to a specific list of users, you can use the "realm permit" command to do so. Collect your list of users and run:
# realm permit -v -R AD.UMD.EDU <DIR_ID>@AD.UMD.EDU <DIR_ID>@AD.UMD.EDU ...

For example:
# realm permit -v -R AD.UMD.EDU cbettenh@AD.UMD.EDU henry@AD.UMD.EDU
 * /usr/bin/systemctl restart sssd.service
 * Successfully changed permitted logins for realm

In /etc/sssd/sssd.conf, the command above results in the following changes:
# This is changed to 'simple' from 'ad' to activate the simple access controls.
access_provider = simple
# Actual list of users that are allowed access.
simple_allow_users = cbettenh, henry

As noted in the "realm permit" output, the sss daemon is automatically restarted after the changes are made, so manual restarting the daemon is not needed.

The users specified should now be able to log into the host.

Restricting Access by Group

Similar to the user section above, if you’d like to restrict access to a host to a specific list of AD groups, you can also use the "realm permit" command to do so. Collect your list of groups and run:
# realm permit -v -R AD.UMD.EDU -g <AD_GROUP1>@AD.UMD.EDU <AD_GROUP2>@AD.UMD.EDU ...

For example:
# realm permit -v -R AD.UMD.EDU -g itserveraaccess-ls@AD.UMD.EDU itunixgrpa-gs@AD.UMD.EDU
 * /usr/bin/systemctl restart sssd.service
 * Successfully changed permitted logins for realm

 
 
 
 

Again, similar to the user example, the command above causes the following changes to /etc/sssd/sssd.conf:
# This is changed to 'simple' from 'ad' to activate the simple access controls.
access_provider = simple
# Actual list of groups that are allowed access.
simple_allow_groups = itserveraaccess-ls@AD.UMD.EDU, itunixgrpa-gs@AD.UMD.EDU

Only members of the specified groups are now allows access to this host.

Leaving the Domain

If you’d like to unbind a host from DIT’s Active Directory service, follow the instructions below:

  1. Log into the host and elevate your privileges.
  2. Remove the host from the configured realm.
    If you simply want to leave the domain but allow the AD object to remain:
    realm leave AD.UMD.EDU

    If you want to leave the domain and delete the AD object:
    realm leave --remove -U <DIR_ID>.admin@AD.UMD.EDU AD.UMD.EDU
  3. Done!

Advanced Settings

Disable use_fully_qualified_names

By default, use_fully_qualified_domain_names is enabled in /etc/sssd/sssd.conf. According to the sssd.conf manual page, if use_fully_qualified_names is enabled, “… all requests to this domain must use fully qualified names.” For example, login username must be specified as “<DIR_ID>@AD.UMD.EDU” rather than just “<DIR_ID>”.

In many cases, this is unnecessary if all of your users and resources are in a single domain and you have no local users. In that case, you can disable use_fully_qualified_domain_names:
# Disable use_fully_qualified_domain_names so we don't always have to specify our AD domain.
use_fully_qualified_names = False

# Also remove the domain from home directories for consistency.
fallback_homedir = /home/%u

 

This then allows users to log in using their directory ID only e.g.:
% ssh cbettenh@itusunix0001.ad.umd.edu
cbettenh@itusunix0001.ad.umd.edu's password:
[...]
Last login: Mon Jun  9 11:39:45 2025 from 10.206.37.171
[cbettenh@itusunix0001 ~]$

Looking up account information can also now be done using the directory ID only e.g.:
# getent passwd cbettenh
cbettenh@AD.UMD.EDU:*:866475304:1491000513:cbettenh:/home/cbettenh:/bin/bash

The fully-qualified name can still be used though if needed:
# getent passwd cbettenh@AD.UMD.EDU
cbettenh@AD.UMD.EDU:*:866475304:1491000513:cbettenh:/home/cbettenh:/bin/bash

Troubleshooting

Generic troubleshooting guidelines:
Troubleshooting Basics - sssd.io

Enabling debug output in SSSD

Add the following value to the “[domain/AD.UMD.EDU]” section of your /etc/sssd/sssd.conf file:
debug = 6

NOTE: Debug values may be in the range of 0 - 9. See the sssd.conf manual page for more options ("man sssd.conf").

Then restart SSSD:
systemctl restart sssd

Dynamic DNS errors

In RHEL, if you see dyndns errors in the sssd_AD.UMD.EDU.log file like this:
(2025-06-07 16:09:04): [be[AD.UMD.EDU]] [ad_dyndns_sdap_update_done] (0x0040): Dynamic DNS update failed [1432158240]: Dynamic DNS update failed

Be sure you have updated the crypto-policies to include AD-SUPPORT:
update-crypto-policies --set DEFAULT:AD-SUPPORT