This episode covers winbind: joining an Active Directory domain as a member server with net ads join, mapping AD users to local UID/GIDs by winbindd, and Linux login authentication with AD credentials. You also configure security = ads, realm, winbind use default domain, and an idmap scheme for stable UID ranges.

In episode 9 you built a Domain Controller. Now we put that domain to use: turning another Samba server into a domain member — a machine that joins AD but isn't a DC — so AD users can log into Linux and access shares. The hero is winbindd, the daemon that translates domain identities (SIDs) into Unix identities (UID/GID). This is the integration that makes the phrase "log in once for everything" real in the Linux world.
Don't confuse this with episode 9: a member server joins an existing domain, uses the DC for authentication, and provides services (file/print) to domain users. It doesn't store the AD database. The daemons at work: smbd (files) + winbindd (identities) + nmbd (optional). Member mode is the most common way to add Linux to an existing Windows environment.
Before joining, the server must be able to find the DC. Test with an AD client tool:
host -t SRV _ldap._tcp.lab.localIf it fails, fix /etc/resolv.conf to point at the DC's address (episode 9). Joining without correct DNS always fails — this is pitfall number one.
sudo net ads join -U Administratornet ads join uses domain admin credentials, creates a computer account in AD, and writes the Kerberos file. Verify:
net ads testjoin
klist -knet ads testjoin confirms the machine trust is valid; klist -k shows the machine keytab used for Kerberos.
[global]
workgroup = LAB
security = ads
realm = LAB.LOCAL
winbind use default domain = yes
winbind enum users = yes
winbind enum groups = yes
winbind refresh tickets = yes
idmap config * : backend = tdb
idmap config * : range = 3000-7999
idmap config LAB : backend = rid
idmap config LAB : range = 10000-999999Breaking down the important parts:
security = ads: authenticate via Active Directory (not NT4-style domain).realm = LAB.LOCAL: the Kerberos realm name — must be exactly the domain FQDN.winbind use default domain = yes: users are referred to as budi, not LAB\budi — reduces confusion on systems that use plain usernames.winbind enum users/groups = yes: getent passwd and getent group can list AD objects.* (default): backend tdb for non-domain accounts (e.g. internal groups) in the low range 3000-7999.LAB (domain-specific): backend rid — UIDs computed deterministically from the RID (the last bits of the SID), so they are stable on every machine. This is crucial: a file written as UID 10023 on machine A has the same UID on machine B, with no collisions.Imagine a share accessed by two servers. Without a consistent idmap, the same user could be mapped to different UIDs on each server — files created on server A look owned by a different user on server B. The rid backend solves this with a deterministic hash. The 10000-999999 range gives plenty of room without colliding with local users (usually < 1000).
Important
idmap config is one of the hardest decisions to change after production. Switching the backend from tdb to rid after files have spread out means UIDs change → file ownership appears "lost". Choose your idmap strategy carefully before the domain holds much data, and document it in your runbook.
sudo systemctl enable --now winbinddThen connect winbind to NSS — the /etc/nsswitch.conf file that determines the sources for user/group lookups:
passwd: files winbind
group: files winbind
shadow: files winbindThe order files winbind means local users are looked up first, then winbind. Restart the services that read NSS:
sudo systemctl restart nscd # atau sssdwbinfo -u
wbinfo -g
getent passwd budi
id budiwbinfo -u/-g: list users/groups from the domain.getent passwd budi: the AD user appears as a passwd entry — proof NSS works.id budi: shows the UID/GID from idmap — proof the mapping is active.For SSH/console login with AD credentials, integrate PAM with winbind — on Debian/Ubuntu, install the libpam-winbind package and run pam-auth-update, while the RHEL family uses authselect with the winbind profile. Once active, test SSH login with an AD user:
ssh budi@fileserverThe key to this pattern: authentication (password) is verified by the DC, identity (UID/GID) is provided by winbind — one password source, many consistent machines.
Tip
AD users often fail to log in without a clear message. The correct debug sequence: klist -k (keytab valid?), wbinfo -t (domain trust OK?), getent passwd <user> (NSS working?), then check journalctl -u winbindd and log level (episode 16). This sequence saves hours of guesswork debugging.
With winbind active, shares can use AD users/groups directly:
[data]
path = /srv/data
valid users = @LAB\staf
writable = yesvalid users = @LAB\staf restricts access to the AD group staf — and because idmap is consistent, files created by domain users have the same ownership on every member server. This is the payoff of the whole episode: Windows and Linux users share the same space with the same identity.
net ads join is very DNS-sensitive.getent passwd empty even with winbind active: check winbind enum users = yes and restart winbindd; make sure nsswitch includes winbind.rid) on all member servers.winbind offline logon and sensible timeout parameters.Key takeaways:
net ads join and uses the DC for authentication; DNS must be correct first.security = ads, realm, and winbind use default domain are the core member configuration.rid backend produces deterministic UID/GIDs that are consistent across machines.wbinfo -u, getent passwd, and id verify AD identity resolution.In episode 11 next, we'll cover filesystem: permission ACL & quota — nt acl support, POSIX ACL + xattr with the acl_xattr module, NTFS permission mapping, plus per-user/group quota via quota.vfs. This is where Samba's access control reaches Windows-level precision.