You're reading from Linux Networking Cookbook
If you have worked in corporate environments, then you are probably familiar with a directory service such as Active Directory. What you may not realize is that Samba, originally created to be an open source implementation of Windows file sharing (SMB/CIFS), can now operate as an Active Directory compatible directory service. It can even act as a Backup Domain Controller (BDC) in an Active Directory domain. In this chapter, we will configure Samba to centralize authentication for your network services. We will also configure a Linux client to leverage it for authentication and set up a RADIUS server, which uses the directory server for authentication.
As of Samba 4.0, Samba has the ability to act as a primary domain controller (PDC) in a manner that is compatible with Active Directory.
Installing on Ubuntu 14.04:
Configure your system with a static IP address and update
/etc/hosts
to point to that IP address rather than localhost.Make sure that your time is kept up to date by installing an NTP client:
sudo apt-get install ntp
Pre-emptively disable
smbd/nmbd
from running automatically:sudo bash -c 'echo "manual" > /etc/init/nmbd.override' sudo bash –c 'echo "manual" > /etc/init/smbd.override'
Install Samba and
smbclient
:sudo apt-get install samba smbclient
Remove stock
smb.conf
:sudo rm /etc/samba/smb.conf
Provision the domain:
sudo samba-tool domain provision --realm ad.example.org --domain example --use-rfc2307 --option="interfaces=lo eth1" --option="bind interfaces only=yes" --dns-backend BIND9_DLZ
Symlink...
In order to participate in an AD style domain, you must have the machine joined to the domain using Administrator credentials. This will create the machine's account within the database, and provide credentials to the system for querying the ldap server.
Install
Samba
,heimdal-clients
, andwinbind
:sudo apt-get install winbind
Populate
/etc/samba/smb.conf
:[global] workgroup = EXAMPLE realm = ad.example.org security = ads idmap uid = 10000-20000 idmap gid = 10000-20000 winbind enum users = yes winbind enum groups = yes template homedir = /home/%U template shell = /bin/bash winbind use default domain = yes
Join the system to the domain:
sudo net ads join -U Administrator
Configure the system to use
winbind
for account information in/etc/nsswitch.conf
:passwd: compat winbind group: compat winbind