The Official Samba 4 Howto
The official Samba 4 howto provides comprehensive guidance for administrators and IT professionals seeking to deploy, configure, and maintain Samba 4 as a reliable Active Directory-compatible domain controller. As a powerful open-source solution, Samba 4 enables integration with ...
Overview
Understanding Samba 4 and Its Capabilities
Before diving into the installation and configuration steps, it’s essential to grasp what Samba 4 offers and how it fits into your network infrastructure.What is Samba 4?
Samba 4 is an open-source software suite that provides seamless file and print services compatible with Windows clients. It also functions as an Active Directory Domain Controller, enabling Linux servers to participate fully in Windows-based networks. Samba 4 supports LDAP, Kerberos, DFS, and other features necessary for enterprise-grade domain management.
Key Features of Samba 4
- Active Directory Domain Controller (AD DC)
- Domain Name System (DNS) integration
- Kerberos authentication
- LDAP directory services
- Group Policy Objects (GPO) support
- Replication and multi-master capabilities
Prerequisites for Installing Samba 4
Successful deployment depends on appropriate planning and environment setup.Hardware Requirements
- Minimum of 2 GB RAM (more recommended for larger environments)
- At least 20 GB of disk space for the system and Samba data
- Reliable network connectivity
Software Requirements
- Supported Linux distribution (Ubuntu, CentOS, Debian, Fedora, etc.)
- Latest stable version of Samba 4
- DNS server (can be integrated with Samba)
- Properly configured hostname and timezone
Network Planning
- Assign static IP addresses to Samba servers
- Configure DNS resolution correctly
- Plan for domain names and organizational units (OUs)
Installing Samba 4
This section covers the core steps to install Samba 4 on your Linux server.Adding Necessary Repositories
Depending on your Linux distribution, you may need to add specific repositories or update existing ones to access the latest Samba packages.
For Ubuntu/Debian
sudo apt update
sudo apt install samba smbclient krb5-user dnsutils
For CentOS/Fedora
sudo dnf install samba samba-client samba-common krb5-workstation bind-utils
Installing Samba from Package Manager
Execute the appropriate command for your distribution to install Samba 4.
Ubuntu/Debian
sudo apt install samba
CentOS/Fedora
sudo dnf install samba
Verifying the Installation
Ensure Samba is installed correctly by checking its version:
smbd --version
This should output the installed Samba version, confirming the installation was successful.
---Provisioning Samba as an Active Directory Domain Controller
The next crucial step is to provision Samba 4 to act as your organization's AD DC.Preparing the Environment
- Stop any running Samba services:
sudo systemctl stop smbd nmbd
Provisioning the Domain
Run the Samba provisioning command with your desired domain details:
sudo samba-tool domain provision --use-rfc2307 --interactive
During the process, you'll be prompted to specify:
- Domain name (e.g., EXAMPLE)
- Realm (e.g., EXAMPLE.COM)
- DNS forwarder IP address (e.g., your ISP's DNS or internal DNS server)
- Administrator password for the domain
Configuring the Kerberos Realm
The provisioning process generates a Kerberos configuration file (/etc/krb5.conf) tailored to your domain. Review and adjust it if necessary to match your network setup.
Configuring and Starting Samba Services
Once provisioned, configure Samba to start automatically and verify its operation.Systemd Service Management
sudo systemctl enable samba-ad-dc
sudo systemctl start samba-ad-dc
Check service status:
sudo systemctl status samba-ad-dc
DNS Configuration
Samba 4 manages its own DNS server by default. Ensure that your server's DNS settings point to the Samba DNS or configure your network to use it as the primary DNS resolver.
Firewall Settings
Open necessary ports for Samba and DNS:
sudo firewall-cmd --add-service=samba --permanent
sudo firewall-cmd --add-service=dns --permanent
sudo firewall-cmd --reload
---
Joining Windows Clients to the Samba Domain
After successfully setting up Samba as a domain controller, clients can join the domain.Creating User Accounts
sudo samba-tool user create username
Adding Machines to the Domain
On Windows clients, navigate to System Properties > Change settings > Change, then select "Domain" and enter your domain name. You’ll need administrator credentials to join.
Verifying Domain Membership
- Use command prompt:
net ads testjoin - Check the list of domain members on your Samba server:
sudo samba-tool domain info yourdomain
---
Managing and Maintaining Samba 4
Continual management ensures your Samba AD remains secure and efficient.Managing Users and Groups
- Create users:
sudo samba-tool user create username - Modify user attributes
- Create and manage groups similarly using samba-tool commands
Implementing Group Policies
Samba 4 supports GPOs through tools like Samba GPO or by integrating with Windows management tools. Proper GPO setup enables centralized policy enforcement.
Backing Up Samba Data
- Backup configuration files (
/etc/samba) - Export LDAP data using
ldbsearch - Maintain regular snapshots of your system and domain data
Updating Samba 4
Keep Samba updated to benefit from security patches and new features:
sudo apt update && sudo apt upgrade samba
or
sudo dnf update samba
---
Troubleshooting Common Issues
Deploying Samba 4 can encounter obstacles; here are some typical problems and solutions.DNS Resolution Failures
- Verify DNS records and forwarders
- Ensure the server correctly resolves its own hostname
Kerberos Authentication Problems
- Check
/etc/krb5.conffor correct realm and KDC settings - Ensure time synchronization across all machines
Samba Service Not Starting
- Review logs in
/var/log/samba/ - Validate configuration syntax with
samba-tool testparm