Updated: 28 September 2026 · Applies to: Ubuntu 24.04, Debian 12, AlmaLinux 9 and Rocky Linux 9
CentOS 7 / RHEL 7 are end of life; these steps join AlmaLinux 9 / Rocky Linux 9 (and Ubuntu 24.04) to an Active Directory domain with realmd and SSSD, so domain users can log in.
Before you start
- The server must use the domain controllers as DNS servers, and the clocks must be in sync (chrony).
- You need an AD account that may join computers to the domain.
Install
dnf install realmd sssd oddjob oddjob-mkhomedir adcli samba-common-tools krb5-workstation # AlmaLinux / Rocky apt install realmd sssd sssd-tools libnss-sss libpam-sss adcli samba-common-bin oddjob oddjob-mkhomedir packagekit # Ubuntu
Join the domain
realm discover ad.example.com realm join --user=Administrator ad.example.com realm list
On Ubuntu also enable automatic home folders: pam-auth-update --enable mkhomedir.
Test and limit access
id alice@ad.example.com realm permit -g "Linux Admins@ad.example.com" # only this group may log in
To log in with just the user name (without @ad.example.com), set use_fully_qualified_names = False in /etc/sssd/sssd.conf and restart SSSD. Give sudo rights with a file in /etc/sudoers.d/, for example %linux\ admins ALL=(ALL) ALL.