Ubuntu 18.04
Sponsored Link

Samba : Samba AD DC : Join in Existing Domain2018/06/27

Add Samba DC in Existing Windows AD Domain.
This example is based on the environment like follows.
Domain Server : Windows Server 2012 R2
NetBIOS名 Nmae : FD3S01
Domain Name : srv.world
Hostname : fd3s.srv.world
Forest/Domain Functional Level   : 2008 R2
[1] Get Doman Administrator's Kerberos Ticket and so on.
apt -y install krb5-user
vi /etc/krb5.conf
# change like follows (replace Realm to your own one)

        default_realm = SRV.WORLD
        dns_lookup_realm = false
        dns_lookup_kdc = true

systemctl stop systemd-resolved

systemctl disable systemd-resolved

Removed /etc/systemd/system/samba-ad-dc.service.
# remove link of resolv.conf and create new one

ll /etc/resolv.conf

lrwxrwxrwx 1 root root 39 Apr 27 10:30 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf
rm /etc/resolv.conf

vi /etc/resolv.conf
# change DNS setting to refer to AD (replace the domain name to your own one)

domain srv.world
kinit administrator

Password for administrator@SRV.WORLD:

Ticket cache: FILE:/tmp/krb5cc_0
Default principal: administrator@SRV.WORLD

Valid starting       Expires              Service principal
06/27/2018 20:52:11  06/28/2018 06:52:11  krbtgt/SRV.WORLD@SRV.WORLD
        renew until 06/28/2018 20:52:07
[2] Add Samba DC to existing AD.
# rename or remove default config

mv /etc/samba/smb.conf /etc/samba/smb.conf.org

samba-tool domain join srv.world DC -U "FD3S01\administrator" --dns-backend=SAMBA_INTERNAL

Finding a writeable DC for domain 'srv.world'
Found DC FD3S.srv.world
Password for [FD3S01\administrator]:
workgroup is FD3S01
realm is srv.world
Adding CN=DLP,OU=Domain Controllers,DC=srv,DC=world
Adding CN=DLP,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=srv,DC=world
Adding CN=NTDS Settings,CN=DLP,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=srv,DC=world
Adding SPNs to CN=DLP,OU=Domain Controllers,DC=srv,DC=world
Setting account password for DLP$
Enabling account
Calling bare provision
Looking up IPv4 addresses
Looking up IPv6 addresses
No IPv6 address will be assigned
Setting up share.ldb
Setting up secrets.ldb
Setting up the registry
Setting up the privileges database
Setting up idmap db
Setting up SAM db
Setting up sam.ldb partitions and settings
Setting up sam.ldb rootDSE
Pre-loading the Samba 4 and AD schema
A Kerberos configuration suitable for Samba AD has been generated at /var/lib/samba/private/krb5.conf
Provision OK for domain DN DC=srv,DC=world
Starting replication
Schema-DN[CN=Schema,CN=Configuration,DC=srv,DC=world] objects[402/1438] linked_values[0/0]
Schema-DN[CN=Schema,CN=Configuration,DC=srv,DC=world] objects[804/1438] linked_values[0/0]
Schema-DN[CN=Schema,CN=Configuration,DC=srv,DC=world] objects[1206/1438] linked_values[0/0]
Schema-DN[CN=Schema,CN=Configuration,DC=srv,DC=world] objects[1608/1438] linked_values[0/0]
Schema-DN[CN=Schema,CN=Configuration,DC=srv,DC=world] objects[1743/1438] linked_values[0/0]
Analyze and apply schema objects
Partition[CN=Configuration,DC=srv,DC=world] objects[402/2159] linked_values[0/39]
Partition[CN=Configuration,DC=srv,DC=world] objects[804/2159] linked_values[0/39]
Partition[CN=Configuration,DC=srv,DC=world] objects[1206/2159] linked_values[0/39]
Partition[CN=Configuration,DC=srv,DC=world] objects[1608/2159] linked_values[0/39]
Partition[CN=Configuration,DC=srv,DC=world] objects[1776/2159] linked_values[39/39]
Replicating critical objects from the base DN of the domain
Partition[DC=srv,DC=world] objects[110/110] linked_values[25/28]
Partition[DC=srv,DC=world] objects[381/4798] linked_values[28/28]
Done with always replicated NC (base, config, schema)
Replicating DC=DomainDnsZones,DC=srv,DC=world
Partition[DC=DomainDnsZones,DC=srv,DC=world] objects[36/36] linked_values[0/0]
Replicating DC=ForestDnsZones,DC=srv,DC=world
Partition[DC=ForestDnsZones,DC=srv,DC=world] objects[19/19] linked_values[0/0]
Exop on[CN=RID Manager$,CN=System,DC=srv,DC=world] objects[3] linked_values[0]
Committing SAM database
Adding 1 remote DNS records for DLP.srv.world
Adding DNS A record DLP.srv.world for IPv4 IP:
Adding DNS CNAME record e856365c-3f62-4774-b8a8-0c8b06d566c7._msdcs.srv.world for DLP.srv.world
All other DNS records (like _ldap SRV records) will be created samba_dnsupdate on first startup
Replicating new DNS records in DC=DomainDnsZones,DC=srv,DC=world
Partition[DC=DomainDnsZones,DC=srv,DC=world] objects[1/36] linked_values[0/0]
Replicating new DNS records in DC=ForestDnsZones,DC=srv,DC=world
Partition[DC=ForestDnsZones,DC=srv,DC=world] objects[1/19] linked_values[0/0]
Sending DsReplicaUpdateRefs for all the replicated partitions
Setting isSynchronized and dsServiceName
Setting up secrets database
Joined domain FD3S01 (SID S-1-5-21-1764851099-3332435390-390327390) as a DC

systemctl stop smbd nmbd winbind

systemctl disable smbd nmbd winbind

systemctl unmask samba-ad-dc

Removed /etc/systemd/system/samba-ad-dc.service.
systemctl start samba-ad-dc

systemctl enable samba-ad-dc
# verify possible authenticate with an AD user to localhost

smbclient // -U Serverworld -c 'ls'

Enter FD3S01\Serverworld's password:
  .                                   D        0  Wed Jun 27 20:54:35 2018
  ..                                  D        0  Wed Jun 27 20:54:35 2018

                29832064 blocks of size 1024. 26234432 blocks available

# verify replication status with AD

samba-tool drs showrepl

DSA Options: 0x00000001
DSA object GUID: e856365c-3f62-4774-b8a8-0c8b06d566c7
DSA invocationId: 6c2f7dda-a93e-4158-9b8b-3a494863c3d9


        Default-First-Site-Name\SMB via RPC
                DSA object GUID: ab920914-1b88-4df9-9146-f2d13d04830e
                Last attempt @ NTTIME(0) was successful
                0 consecutive failure(s).
                Last success @ NTTIME(0)



Connection --
        Connection name: 465f7e2b-02ab-4d47-8265-9e5a7388ddd2
        Enabled        : TRUE
        Server DNS name : smb.srv.world
        Server DN name  : CN=NTDS Settings,CN=SMB,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=srv,DC=world
                TransportType: RPC
                options: 0x00000001
Warning: No NC replicated for Connection!
# for [No NC replicated for Connection!] you don't care it according to samba official site
Matched Content