Debian 12 bookworm
Sponsored Link

Join in Active Directory Domain2023/06/15

 
Join in Windows Active Directory Domain with Realmd.
This tutorial needs Windows Active Directory Domain Service in your LAN.
This example shows to configure on the environment below.
Domain Server : Windows Server 2022
Domain Name : srv.world
Hostname : fd3s.srv.world
NetBIOS Name : FD3S01
Realm : SRV.WORLD
[1] Install some required packages.
root@dlp:~#
apt -y install realmd sssd sssd-tools libnss-sss libpam-sss adcli samba-common-bin oddjob oddjob-mkhomedir packagekit
[2] Join in Windows Active Directory Domain.
# change DNS settings to refer to AD

root@dlp:~#
vi /etc/resolv.conf
domain srv.world
search srv.world
nameserver 10.0.0.100

# * if you are using resolvconf or Networkmanager programs,
# change nameserver setting on a file for their requirements

# discover Active Directory domain

root@dlp:~#
realm discover SRV.WORLD

srv.world
  type: kerberos
  realm-name: SRV.WORLD
  domain-name: srv.world
  configured: no
  server-software: active-directory
  client-software: sssd
  required-package: sssd-tools
  required-package: sssd
  required-package: libnss-sss
  required-package: libpam-sss
  required-package: adcli
  required-package: samba-common-bin

# join in Active Directory domain

root@dlp:~#
realm join SRV.WORLD

Password for Administrator:  
# AD Administrator password
# verify it's possible to get an AD user info or not

root@dlp:~#
id Serverworld@srv.world

uid=1065401103(serverworld@srv.world) gid=1065400513(domain users@srv.world) groups=1065400513(domain users@srv.world),1065401153(esx admins@srv.world),1065400512(domain admins@srv.world),1065400572(denied rodc password replication group@srv.world)

# change setting if you need

root@dlp:~#
vi /etc/pam.d/common-session
# add to the end : create Home Dir automatically when initial login

session optional        pam_mkhomedir.so skel=/etc/skel umask=077

# verify it's possible to login as an AD user or not

root@dlp:~#
exit
logout

Debian GNU/Linux 12 dlp.srv.world ttyS0

dlp login: serverworld@srv.world
Password:
Linux dlp.srv.world 6.1.0-9-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.27-1 (2023-05-08) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Creating directory '/home/serverworld@srv.world'.
serverworld@srv.world@dlp:~$     # logined
[3] If you'd like to omit domain name for AD user, configure like follows.
root@dlp:~#
vi /etc/sssd/sssd.conf
# line 16 : change

use_fully_qualified_names =
False
root@dlp:~#
systemctl restart sssd

root@dlp:~#
id Administrator

uid=1065400500(administrator) gid=1065400513(domain users) groups=1065400513(domain users),1065401153(esx admins),1065400572(denied rodc password replication group),1065400512(domain admins),1065400518(schema admins),1065400520(group policy creator owners),1065400519(enterprise admins)
[4]
AD users UID/GID are assigned randomly, but if you'd like to assign fixed UID/GID, configure like follows.
Add UNIX attributes to AD accounts first, refer to here.
This example is based on the environment AD accounts have [uidNumber/gidNumber] attributes.
Next, change SSSD settings on Debian Server.
root@dlp:~#
vi /etc/sssd/sssd.conf
# line 17 : change

ldap_id_mapping =
False
# add to the end

ldap_user_uid_number = uidNumber
ldap_user_gid_number = gidNumber
# clear cache and restart sssd

root@dlp:~#
rm -f /var/lib/sss/db/*

root@dlp:~#
systemctl restart sssd
root@dlp:~#
id serverworld

uid=5000(serverworld) gid=100(users) groups=100(users)
Matched Content